Needs work
Project:
Cache Router
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Apr 2010 at 11:22 UTC
Updated:
3 Nov 2010 at 19:15 UTC
I am getting this PHP warning in the normal and dev version:
Notice: Undefined variable: set_expire in \htdocs\sites\all\modules\contrib\cacherouter\engines\memcache.php on line 86
if ($expire == CACHE_TEMPORARY || $expire == CACHE_PERMANENT) {
$set_expire = 0;
}
$set_expire is undefined in other cases, like the first time a page is visited and is set in memcache.
Also, with normal caching enabled $expire is f.e. a timestamp and not passed on to Memcache::set().
// Attempt to store full key and value
if (!$this->memcache->set($this->key($key), $cache, $this->settings['compress'], $set_expire)) {
unset($lookup[$this->key($key)]);
$return = FALSE;
}
Like this, there is no cache expiration, as set_expire is always 0 or undefined and the timestamp in $expire is not passed on. It should be
* @param expire int[optional]
* Expiration time of the item. If it's equal to zero, the item will never
* expire. You can also use Unix timestamp or a number of seconds starting
* from current time, but in the latter case the number of seconds may not
* exceed 2592000 (30 days).
*
I checked the memcache API module and they correctly set a expiration time in the future.
if ($expire == CACHE_TEMPORARY) {
// Convert CACHE_TEMPORARY (-1) into something that will live in memcache
// until the next flush.
$cache->expire = time() + 2591999;
}
// Expire time is in seconds if less than 30 days, otherwise is a timestamp.
else if ($expire != CACHE_PERMANENT && $expire < 2592000) {
// Expire is expressed in seconds, convert to the proper future timestamp
// as expected in dmemcache_get().
$cache->expire = time() + $expire;
}
else {
$cache->expire = $expire;
}
Comments
Comment #1
andypostTry to user 6-dev version! Suppose this already fixed
Comment #2
joelstein commentedI get this error with the latest dev.
Comment #3
andypostI've commited quick fix but this still needs work and discussion