From: Evan Prodromou Date: Fri, 29 Jan 2010 20:01:21 +0000 (-0500) Subject: add simple cache getter/setter static functions to Memcached_DataObject X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f6eecf02fc9eca0d3947a8cacf374909003dc8d4;p=quix0rs-gnu-social.git add simple cache getter/setter static functions to Memcached_DataObject --- diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index f4dfe63141..ab65c30ce2 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); + } }