bool scache_chclear(resource session, string path)
bool $SCacheConnection->chclear(string path)

scache_chclear removes values from shared cache.


Session resource returned from scache_open, scache_reset or scache_connect
Slash (/) separated null-terminated path on backend's session tree

Return values

TRUE on success. FALSE on failure. If node was already empty or nonexisting one, TRUE is returned, but error code is set to SCERR_NOTEXIST.

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


When caching data it might be useful to organize them as subtrees by dependency so that they can be expired as entity (complete subtree) when something dependent to them all gets invalidated.



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

/* we cache gradually more and more values */
scache_chput($session, 'freely/droppable/value1', 'for cache only');
scache_chput($session, 'freely/droppable/value2', 'for cache only');
scache_chput($session, 'freely/accessible/data', 'is here');
scache_chput($session, 'freely/exportable/data', 'is here');
scache_chput($session, 'another/data', 'is also available');
scache_chput($session, 'this/is/quite', 'permanent');

/* 'freely' object got modified in database so we expire all 
dependent cached values in one turn by expiring parent key */
scache_chclear($session, 'freely');