scache_shcoll

Description

bool scache_shcoll(resource session, string path, string target)
bool $SCacheConnection->shcoll(string path, string target)

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.)

Parameters

session
Session resource returned from scache_open, scache_reset or scache_connect
path
Path from where subkeys are to be collected. Path needs to be type SCNODE_BRANCH ie. subdirectory.
target
Target path where result is to be stored.

Return values

TRUE on success, FALSE on failure.

In case of failure, error codes resolvable by scache_lasterr is one of below :

Notes

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.

Examples

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