scache_shunset, scache_shclear
Description
bool scache_shunset(resource session, string path)
bool scache_shclear(resource session, string path)
bool scache_shclear(resource session, string path)
bool $SCacheConnection->shclear(string path)
scache_shunset is operationally equal to session spesific scache_unset but unlike it, scache_shunset 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_shunset removes entry from given path on scached's shared storage, scache_shclear is alias to scache_shunset to keep symmetry with class interface.
Parameters
session
path
Slash (/) separated 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 :
- SCERR_NOTEXIST Path given does not exist and won't be created.
- SCERR_NO_SESSION Connected session does not exist or has been expired. Connection is not valid any more.
- SCERR_NO_ACCESS Shared keyspace is not allowed on assigned partition.
- 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.
Generally you can ignore the returned value.
Examples
<?php /* get connection */ $session = scache_reset('MyEasilyGuessableSecret'); scache_shset($session, 'today/i', '..work..work..always..work'); scache_shset($session, 'today/did', '..work..work..always..work'); scache_shset($session, 'today/enourmous', '..work..work..always..work'); scache_shset($session, 'today/amounts', '..work..work..always..work'); scache_shset($session, 'today/of', '..work..work..always..work'); scache_shset($session, 'today/hard', '..work..work..always..work'); scache_shset($session, 'today/and', '..work..work..always..work'); scache_shset($session, 'today/dull', '..work..work..always..work'); scache_shset($session, 'today/and', '..work..work..always..work'); scache_shset($session, 'today/boring', '..work..work..always..work'); scache_shset($session, 'today/work', '..work..work..always..work'); if (scache_shunset($session, 'today')) { echo "..and now its all gone!\n"; } ?>