summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-01-27 09:13:21 -0800
committerBrion Vibber <brion@pobox.com>2010-01-27 09:13:21 -0800
commitb1402896e7dac59ab1eecae4babf83a06d2f256d (patch)
treeb8a296ef8e057b149d4831374dc2ba04ec121f43
parent7aeb03f7277de247a642b613775383480bccc63f (diff)
Set default 24-hour expiry on Memcached objects where not specified.
-rw-r--r--plugins/MemcachePlugin.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/MemcachePlugin.php b/plugins/MemcachePlugin.php
index 8c8b8da6d..2bc4b892b 100644
--- a/plugins/MemcachePlugin.php
+++ b/plugins/MemcachePlugin.php
@@ -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));