diff options
author | Brion Vibber <brion@pobox.com> | 2010-01-27 09:13:21 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-01-27 09:13:21 -0800 |
commit | b1402896e7dac59ab1eecae4babf83a06d2f256d (patch) | |
tree | b8a296ef8e057b149d4831374dc2ba04ec121f43 /plugins/MemcachePlugin.php | |
parent | 7aeb03f7277de247a642b613775383480bccc63f (diff) |
Set default 24-hour expiry on Memcached objects where not specified.
Diffstat (limited to 'plugins/MemcachePlugin.php')
-rw-r--r-- | plugins/MemcachePlugin.php | 5 |
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)); |