scache_setopt
Description
mixed scache_setopt(resource session, long option, mixed new_val)
mixed $SCacheConnection->setopt(long option, mixed new_val)
scache_setopt sets session's options. Settable options are :
- SCACHE_OPT_EXPIRES : current session timeout. Value is checked for minumum of 5 seconds and maximum of about one year. If value to be set exceed limits it itse rounded to limit
- SCACHE_OPT_KEEPONELIMIT : action to do if backend hits memory or node limits. If value is true, session is kept and error reported. If value is false, session is destroyed from scached memory.
Note: this is a grave error situation, as scached backend expects to have enough memory and even more client is expected to control amount of data used. Default action is to destroy session and assume client to panic and inform user.
Parameters
session
option
Currently supported values are SCACHE_OPT_EXPIRES and SCACHE_OPT_KEEPONELIMIT
new_val
New value for specified option.
Return values
Previous setting of specified option or FALSE on error.
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_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.
Examples
<?php /* get connection */ $session = scache_reset('MyEasilyGuessableSecret'); if (scache_setopt($session, SCACHE_OPT_KEEPONELIMIT, true)) { echo "Dont expire me on error!\n"; } ?>