add simple cache getter/setter static functions to Memcached_DataObject

This commit is contained in:
Evan Prodromou 2010-01-29 15:01:21 -05:00
parent 4d3808a815
commit f6eecf02fc

View File

@ -552,4 +552,30 @@ class Memcached_DataObject extends DB_DataObject
{ {
throw new ServerException("DB_DataObject error [$type]: $message"); 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);
}
} }