From: Brion Vibber Date: Wed, 27 Jan 2010 17:13:21 +0000 (-0800) Subject: Set default 24-hour expiry on Memcached objects where not specified. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b1402896e7dac59ab1eecae4babf83a06d2f256d;p=quix0rs-gnu-social.git Set default 24-hour expiry on Memcached objects where not specified. --- diff --git a/plugins/MemcachePlugin.php b/plugins/MemcachePlugin.php index 8c8b8da6dc..2bc4b892bd 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));