mixed scache_shget(resource session, string path)
mixed $SCacheConnection->shget(string path)

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.


Session resource returned from scache_open, scache_reset or scache_connect
Slash (/) separated path on backend's session tree. Path parameter is not binary safe.

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 :


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.



/* 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');