note 90717 modified in function.memcache-delete by danbrown
| From: | danbrown@php.net | Date: | Sat, 19 Jun 2010 14:29:22 +0000 |
| Subject: | note 90717 modified in function.memcache-delete by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-170297@lists.php.net to get a copy of this message | ||
I was searching for a function/method in this class that would "reset" (or
"update", depending on how you look at it) the timeout value for a key. I was searching
my butt off when I finally figured; this is the one.
Example: You have accessed a web-page including something that should be "in-cache" for
way more than 30 days (until the memcache server gets a downtime for some reason). Since the limit
for having something in the cache is 30 days, this will be a problem. Simple (yet somewhat
non-optimal) solution:
<?php
//How to "update" the value
if($memcache_key_exists){
$memcache_obj->delete('key', (3600*24*30));
}
?>
Have fun.
--was--
I was searching for a function/method in this class that would "reset" (or
"update", depending on how you look at it) the timeout value for a key. I was searching
my butt off when I finally figured; this is the one.
Example: You have accessed a web-page including something that should be "in-cache" for
way more than 30 days (until the memcache server gets a downtime for some reason). Since the limit
for having something in the cache is 30 days, this will be a problem. Simple (yet somewhat
non-optimal) solution:
<?php
//How to "update" the value
if($memcache_key_exists){
$memcache_obj->delete('key', (3600*24*30));
}
?>
Have fun.
http://php.net/manual/en/function.memcache-delete.php