scache_shcoll enumerates all direct subkeys in on given path and stores result into path target. Unlike with scache_coll, shared namespace is used.
scache_shcoll produces PHP associative array where array keys are the subkeys found and values are the node's nodetype. This array is stored into path target and it needs to be fetched separately with scache_get (or scache_iov equivalent.)
TRUE on success, FALSE on failure.
In case of failure, error codes resolvable by scache_lasterr is one of below :
- SCERR_NOT_EXIST Path given does not exist or is not type SCNODE_BRANCH (ie. subtree)
- SCERR_NO_ACCESS Either listing or usage of shared namespace is disabled by server config.
- 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.
Subkey listing can be disabled on scached's server config. On shared namespace disabling listing might make sense for example for obscure security reasons, like when you want to prevent separate clients from querying each others stored data.
If you want to list root's contents, you need to query it with path '/'. Empty string does not match root, thought for simplicity first slash can be generally omitted from paths.
Querying with scache_iov
<?php $sess = scache_reset('MySess'); list($success, $listing) = scache_iov($sess, Array(Array(SCIOP_SHCOLL, 'my/path/subkeys', 'my/listing'), Array(SCIOP_SHGET, 'my/listing')));