scache_vget
Description
long scache_vget(resource session, string path)
long $SCacheConnection->vget(string path)
scache_vget gets value from given path
Parameters
session
path
Slash (/) separated null-terminated path on backend's session tree
Return values
Path's current value is returned. Unexistent values are created on fly with initial value 0
In case of failure, error codes resolvable by scache_lasterr is one of below :
- SCERR_NO_SESSION Connected session does not exist or has been expired. Connection is not valid any more.
- SCERR_NO_ACCESS Shared counters are not allowed on assigned partition.
- 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.
Notes
Nonexistent value is considered as 0.
Note also that these are not session specific but common to all clients. Shared counters might be useful for mutual modifications tracking or incremental transient numbering.
Examples
<?php /* get connection */ $session = scache_reset('MyEasilyGuessableSecret'); scache_vset($session, 'my/path', 2); if (scache_vget($session, 'my/path') !== 2) { echo "This software is crap!\n"; } ?>