merged branch vicb/memcache/fix (PR #3363)

Commits
-------

b95284e [Profiler] Fix memcache(d)

Discussion
----------

[Profiler] Fix memcache(d) storages

This fixes an ambiguity...

The memcache(d) storages have a `$lifetime` option. The name indicates that we are talking about a ttl (in seconds). This is wrong is `$lifetime` > 2592000 (=30 days), see http://fr.php.net/manual/en/memcache.set.php.

Doctrine is also [affected](e9ab2d2cca).

The ambiguity also exists in the session storage but to a lesser extend as those storage directly use memcache(d) options rather than a `$lifetime`. @drak could you confirm ?

Hopefully the Cache Component will get it right (#3211).
This commit is contained in:
Fabien Potencier 2012-02-15 11:11:34 +01:00
commit 3f76d0f60f
3 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,7 @@ abstract class BaseMemcacheProfilerStorage implements ProfilerStorageInterface
* @param string $dsn A data source name
* @param string $username
* @param string $password
* @param int $lifetime The lifetime to use for the purge
* @param int $lifetime The lifetime to use for the purge
*/
public function __construct($dsn, $username = '', $password = '', $lifetime = 86400)
{

View File

@ -63,7 +63,7 @@ class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage
*/
protected function setValue($key, $value, $expiration = 0)
{
return $this->getMemcache()->set($key, $value, false, $expiration);
return $this->getMemcache()->set($key, $value, false, time() + $expiration);
}
/**

View File

@ -67,7 +67,7 @@ class MemcachedProfilerStorage extends BaseMemcacheProfilerStorage
*/
protected function setValue($key, $value, $expiration = 0)
{
return $this->getMemcached()->set($key, $value, $expiration);
return $this->getMemcached()->set($key, $value, false, time() + $expiration);
}
/**