Set default 24-hour expiry on Memcached objects where not specified.

This commit is contained in:
Brion Vibber 2010-01-27 09:13:21 -08:00
parent 7aeb03f727
commit b1402896e7

View File

@ -59,6 +59,8 @@ class MemcachePlugin extends Plugin
public $persistent = null;
public $defaultExpiry = 86400; // 24h
/**
* Initialize the plugin
*
@ -110,6 +112,9 @@ class MemcachePlugin extends Plugin
function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success)
{
$this->_ensureConn();
if ($expiry === null) {
$expiry = $this->defaultExpiry;
}
$success = $this->_conn->set($key, $value, $flag, $expiry);
Event::handle('EndCacheSet', array($key, $value, $flag,
$expiry));