summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-02-06 06:48:41 +0000
committerZach Copley <zach@status.net>2010-02-06 06:48:41 +0000
commitfc226a6ad5c4b120858b70d3af4d6f9c288d08d6 (patch)
treea35918d128f8a70e5e5ab8a4de9c38aae0c4ce7a /plugins
parent70abea3ac4034cbbfc68cdc8288fc7e2d1cea17c (diff)
parent875e1a70ce231b6b07765210328656abb353ad5b (diff)
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
Diffstat (limited to 'plugins')
-rw-r--r--plugins/MemcachePlugin.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/plugins/MemcachePlugin.php b/plugins/MemcachePlugin.php
index 2bc4b892b..c5e74fb41 100644
--- a/plugins/MemcachePlugin.php
+++ b/plugins/MemcachePlugin.php
@@ -102,7 +102,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
*
@@ -115,7 +115,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;
@@ -197,6 +197,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',