X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FXCachePlugin.php;h=2baa290ed294cee8cdc98f17a805fd4bf39f8d44;hb=37f3a3d558ba55a085c9ee5427948b572c197bc3;hp=8011e659ae9035059e340f56fbb7974eac5a74d3;hpb=121c696267ffa863df7475d5dd7e45d41db33023;p=quix0rs-gnu-social.git diff --git a/plugins/XCachePlugin.php b/plugins/XCachePlugin.php index 8011e659ae..2baa290ed2 100644 --- a/plugins/XCachePlugin.php +++ b/plugins/XCachePlugin.php @@ -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 XCache variable cache to cache query results.')); + return true; + } }