]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Set default 24-hour expiry on Memcached objects where not specified.
authorBrion Vibber <brion@pobox.com>
Wed, 27 Jan 2010 17:13:21 +0000 (09:13 -0800)
committerBrion Vibber <brion@pobox.com>
Wed, 27 Jan 2010 17:13:21 +0000 (09:13 -0800)
plugins/MemcachePlugin.php

index 8c8b8da6dc183cdd45dfef86598dee23fea58148..2bc4b892bd6a287c9750c73060f7522f68db5bf5 100644 (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));