mixed scache_get(resource session, string path)
mixed $SCacheConnection->get(string path)

scache_get retrieves given path from backend. Path is a slash (/) separated NULL-terminated string to eligible location on backend's session-private tree


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 or error occurred.

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_exists and scache_get doesn't guarantee an exact result, because data may have been changed between them by another querier.



/* get connection */
$session = scache_reset('MyEasilyGuessableSecret');

/* store and get */
if (scache_set($session, 'my/values/path', 42) &&
    scache_get($session, 'my/values/path') != 42) {

    /* unlikely to happen */
    die('scached is broken or someone got in middle');