]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/XCachePlugin.php
Merge branch 'master' into testing
[quix0rs-gnu-social.git] / plugins / XCachePlugin.php
index 8011e659ae9035059e340f56fbb7974eac5a74d3..2baa290ed294cee8cdc98f17a805fd4bf39f8d44 100644 (file)
@@ -63,8 +63,10 @@ class XCachePlugin extends Plugin
 
     function onStartCacheGet(&$key, &$value)
     {
-        $value = xcache_get($key);
-        if (!is_null($value)) {
+        if (!xcache_isset($key)) {
+            $value = false;
+        } else {
+            $value = xcache_get($key);
             $value = unserialize($value);
         }
         Event::handle('EndCacheGet', array($key, &$value));
@@ -85,8 +87,7 @@ class XCachePlugin extends Plugin
 
     function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success)
     {
-        $success = xcache_set($key, serialize($value),
-                              (is_null($expiry) ? 0 : $expiry));
+        $success = xcache_set($key, serialize($value));
 
         Event::handle('EndCacheSet', array($key, $value, $flag,
                                            $expiry));
@@ -108,5 +109,16 @@ class XCachePlugin extends Plugin
         Event::handle('EndCacheDelete', array($key));
         return false;
     }
+
+    function onPluginVersion(&$versions)
+    {
+        $versions[] = array('name' => 'XCache',
+                            'version' => STATUSNET_VERSION,
+                            'author' => 'Craig Andrews',
+                            'homepage' => 'http://status.net/wiki/Plugin:XCache',
+                            'rawdescription' =>
+                            _m('Use the <a href="http://xcache.lighttpd.net/">XCache</a> variable cache to cache query results.'));
+        return true;
+    }
 }