scache_get
Description
scache_get retrieves given path from backend. Path is a slash (/) separated NULL-terminated string to eligible location on backend's session-private tree
Parameters
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 :
- 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_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_exists and scache_get doesn't guarantee an exact result, because data may have been changed between them by another querier.
Examples
<?php
/* 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');
}
?>
