scache_unset, scache_clear
Description
bool scache_unset(resource session, string path)
bool scache_clear(resource session, string path)
bool scache_clear(resource session, string path)
bool $SCacheConnection->clear(string path)
scache_unset removes entry from given path on scached's session-private storage, scache_clear is alias to scache_unset 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_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_set($session, 'today/i', '..work..work..always..work'); scache_set($session, 'today/did', '..work..work..always..work'); scache_set($session, 'today/enourmous', '..work..work..always..work'); scache_set($session, 'today/amounts', '..work..work..always..work'); scache_set($session, 'today/of', '..work..work..always..work'); scache_set($session, 'today/hard', '..work..work..always..work'); scache_set($session, 'today/and', '..work..work..always..work'); scache_set($session, 'today/dull', '..work..work..always..work'); scache_set($session, 'today/and', '..work..work..always..work'); scache_set($session, 'today/boring', '..work..work..always..work'); scache_set($session, 'today/work', '..work..work..always..work'); scache_unset($session, 'today'); echo "..and now its all gone!\n"; ?>