]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add simple cache getter/setter static functions to Memcached_DataObject
authorEvan Prodromou <evan@status.net>
Fri, 29 Jan 2010 20:01:21 +0000 (15:01 -0500)
committerEvan Prodromou <evan@status.net>
Fri, 29 Jan 2010 20:01:21 +0000 (15:01 -0500)
classes/Memcached_DataObject.php

index f4dfe631419acafbd78e393098468ac84dcd9f0b..ab65c30ce28579a8684b4e9fa8d9cc8124d2b833 100644 (file)
@@ -552,4 +552,30 @@ class Memcached_DataObject extends DB_DataObject
     {
         throw new ServerException("DB_DataObject error [$type]: $message");
     }
+
+    static function cacheGet($keyPart)
+    {
+        $c = self::memcache();
+
+        if (empty($c)) {
+            return false;
+        }
+
+        $cacheKey = common_cache_key($keyPart);
+
+        return $c->get($cacheKey);
+    }
+
+    static function cacheSet($keyPart, $value)
+    {
+        $c = self::memcache();
+
+        if (empty($c)) {
+            return false;
+        }
+
+        $cacheKey = common_cache_key($keyPart);
+
+        return $c->set($cacheKey, $value);
+    }
 }