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

andypost’s picture

Try to user 6-dev version! Suppose this already fixed

joelstein’s picture

Version: 6.x-1.0-rc1 » 6.x-1.x-dev

I get this error with the latest dev.

andypost’s picture

Status: Active » Needs work

I've commited quick fix but this still needs work and discussion