summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-01-29 15:01:21 -0500
committerEvan Prodromou <evan@status.net>2010-01-29 15:01:21 -0500
commitf6eecf02fc9eca0d3947a8cacf374909003dc8d4 (patch)
tree4e2aa70983ffc860938b07c5783eb5c0bdebb24b
parent4d3808a815dd8a020cf17151e4c04a821790169d (diff)
add simple cache getter/setter static functions to Memcached_DataObject
-rw-r--r--classes/Memcached_DataObject.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php
index f4dfe6314..ab65c30ce 100644
--- a/classes/Memcached_DataObject.php
+++ b/classes/Memcached_DataObject.php
@@ -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);
+ }
}