scache_shstat
Description
long scache_shstat(resource session, string path)
long $SCacheConnection->shstat(string path)
scache_shstat is operationally equal to session spesific scache_stat but unlike it, scache_shstat 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_shstat queries node given path and returns existence and type of it. Return value is :
- SCNODE_EMPTY Node has been removed. Must be considered as nonexisting value. scache_shexists would return false.
- SCNODE_NONEXISTENT Node does not exist, scache_shexists would return false.
- SCNODE_BRANCH Node contains subtree, ie. is path containing another subvalues. (Directory).
- SCNODE_VALUE Node contains value and is not subtree.
Parameters
session
path
Slash (/) separated path on backend's session tree. Path parameter is not binary safe.
Return values
Node type success, FALSE on failure. Node types are :
- SCNODE_NONEXISTENT Path does not exist.
- SCNODE_EMPTY Path has once existed, but has been cleared. Must be considered as not existing path ie same as nodetype SCNODE_NONEXISTENT.
- SCNODE_BRANCH Path queried is node containing subnodes ie. directory.
- SCNODE_VALUE Path queried is node containing value.
In case of failure, error codes resolvable by scache_lasterr is one of below :
- SCERR_NO_SESSION Connected session does not exist or has been expired. Connection is not valid any more.
- 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.
Examples
<?php /* get connection */ $session = scache_reset('ThisHasNoEffect'); scache_shset($session, 'this/is/my/path', 'value'); if (scache_shstat($session, 'this/is/my/path') == SCNODE_VALUE) echo "Yes, this is SCNODE_VALUE...\n"; if (scache_shstat($session, 'this/is/my') == SCNODE_BRANCH) echo "..and yes, you are right, this is SCNODE_BRANCH..\n"; ?>