scache_shget
Description
scache_shget is operationally equal to session spesific scache_get but unlike it, scache_shget operates on shared storage that is common and accessible for all clients. Shared storage is for operating data common to all clients and for inter-client communication.
scache_shget retrieves given path from backend. Path is a slash (/) separated NULL-terminated string to eligible location on all accessible shared storage.
Parameters
Return values
Stored content on success or FALSE if given path does not exist.
In case of failure, error codes resolvable by scache_lasterr is one of below :
- SCERR_NOTEXIST Path given does not exist.
- SCERR_NO_SESSION Connected session does not exist or has been expired. Connection is not valid any more.
- SCERR_NO_ACCESS Shared keyspace is not allowed on assigned partition.
- SCERR_LIMITS_REACHED Partition has exceeded its memory or node limits and new session cannot be created until memory is freed.
- SCERR_NOT_CONNECTED Connection to backend is broken and cannot be reconnected.
- SCERR_PROTOCOL Internal protocol error has occurred when communicating to backend. This indicates something is severely broken.
Notes
One probable situation is that you get a result FALSE and you need to distinguish between whether it means that value does not exist or value itself is FALSE. You can find it out either with querying scache_lasterr for value SCERR_NOTEXIST or with exists testing batch operation with scache_iov. Note that separate scache_shexists and scache_shget doesn't guarantee an exact result, because data may have been changed between them by another querier.
Examples
<?php /* get connection */ $session = scache_shreset('ThisHaveNoEffect'); /* store and get */ if (scache_shset($session, 'this/is/shared/for/all', 42) && scache_shget($session, 'this/is/shared/for/all') != 42) { /* unlikely to happen */ die('scached is broken or someone got in middle'); } ?>