note 70896 added to function.apc-store
| From: | php at tequilasolutions dot com | Date: | Fri, 03 Nov 2006 11:45:27 +0000 |
| Subject: | note 70896 added to function.apc-store | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119332@lists.php.net to get a copy of this message | ||
Seems to be no (easy) way at the to know how old a value fetched is and to check whether it is out
of date.
I've made these wrappers so that you can fetch and store values based on a udt returned from
get_last_modified_date() which should return a udt of when your data was last changed, and hence
needs junking out of the cache.
function apc_fetch_udt($key){
$g = apc_fetch($key);
if ($g){
list($udt,$val) = $g;
if (get_last_modified_date()<$udt) {
$val = unserialize($val);
return $val;
} else {
apc_delete($key);
}
}
}
function apc_store_udt($key,$g){
$udt = time();
$g = serialize($g);
$apc = array($udt,$g);
apc_store($key, $apc);
}
----
Server IP: 85.116.0.130
Probable Submitter: 62.30.229.146
----
Manual Page -- http://www.php.net/manual/en/function.apc-store.php
Edit -- https://master.php.net/note/edit/70896
Del: integrated -- https://master.php.net/note/delete/70896/integrated
Del: useless -- https://master.php.net/note/delete/70896/useless
Del: bad code -- https://master.php.net/note/delete/70896/bad+code
Del: spam -- https://master.php.net/note/delete/70896/spam
Del: non-english -- https://master.php.net/note/delete/70896/non-english
Del: in docs -- https://master.php.net/note/delete/70896/in+docs
Del: other reasons-- https://master.php.net/note/delete/70896
Reject -- https://master.php.net/note/reject/70896
Search -- https://master.php.net/manage/user-notes.php