X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FMemcachePlugin.php;h=c3ca5c135928e52e9c4d5a897f2b030f227a84f1;hb=338aa4bf1d36e11a354c67796509c6d1fec2aac2;hp=93a0583fe8e703527bc715066ffbf5c4c891a214;hpb=c74aea589d5a79d7048470d44e457dffc8919ad3;p=quix0rs-gnu-social.git diff --git a/plugins/MemcachePlugin.php b/plugins/MemcachePlugin.php index 93a0583fe8..c3ca5c1359 100644 --- a/plugins/MemcachePlugin.php +++ b/plugins/MemcachePlugin.php @@ -115,7 +115,7 @@ class MemcachePlugin extends Plugin * * @param string &$key in; Key to use for lookups * @param mixed &$value in; Value to associate - * @param integer &$flag in; Flag (passed through to Memcache) + * @param integer &$flag in; Flag empty or Cache::COMPRESSED * @param integer &$expiry in; Expiry (passed through to Memcache) * @param boolean &$success out; Whether the set was successful * @@ -128,7 +128,7 @@ class MemcachePlugin extends Plugin if ($expiry === null) { $expiry = $this->defaultExpiry; } - $success = $this->_conn->set($key, $value, $flag, $expiry); + $success = $this->_conn->set($key, $value, $this->flag(intval($flag)), $expiry); Event::handle('EndCacheSet', array($key, $value, $flag, $expiry)); return false; @@ -228,6 +228,20 @@ class MemcachePlugin extends Plugin } } + /** + * Translate general flags to Memcached-specific flags + * @param int $flag + * @return int + */ + protected function flag($flag) + { + $out = 0; + if ($flag & Cache::COMPRESSED == Cache::COMPRESSED) { + $out |= MEMCACHE_COMPRESSED; + } + return $out; + } + function onPluginVersion(&$versions) { $versions[] = array('name' => 'Memcache',