common_keyize() -> Cache::keyize()

This commit is contained in:
Evan Prodromou 2010-09-06 10:03:51 -04:00
parent c2de44a530
commit e42d2124a3
6 changed files with 10 additions and 15 deletions

View File

@ -302,7 +302,7 @@ class Memcached_DataObject extends Safe_DataObject
$inst->query($qry);
return $inst;
}
$key_part = common_keyize($cls).':'.md5($qry);
$key_part = Cache::keyize($cls).':'.md5($qry);
$ckey = common_cache_key($key_part);
$stored = $c->get($ckey);

View File

@ -1941,10 +1941,10 @@ class Notice extends Memcached_DataObject
if ($tag->find()) {
while ($tag->fetch()) {
self::blow('profile:notice_ids_tagged:%d:%s', $this->profile_id, common_keyize($tag->tag));
self::blow('profile:notice_ids_tagged:%d:%s;last', $this->profile_id, common_keyize($tag->tag));
self::blow('notice_tag:notice_ids:%s', common_keyize($tag->tag));
self::blow('notice_tag:notice_ids:%s;last', common_keyize($tag->tag));
self::blow('profile:notice_ids_tagged:%d:%s', $this->profile_id, Cache::keyize($tag->tag));
self::blow('profile:notice_ids_tagged:%d:%s;last', $this->profile_id, Cache::keyize($tag->tag));
self::blow('notice_tag:notice_ids:%s', Cache::keyize($tag->tag));
self::blow('notice_tag:notice_ids:%s;last', Cache::keyize($tag->tag));
$tag->delete();
}
}

View File

@ -40,7 +40,7 @@ class Notice_tag extends Memcached_DataObject
$ids = Notice::stream(array('Notice_tag', '_streamDirect'),
array($tag),
'notice_tag:notice_ids:' . common_keyize($tag),
'notice_tag:notice_ids:' . Cache::keyize($tag),
$offset, $limit);
return Notice::getStreamByIds($ids);
@ -82,9 +82,9 @@ class Notice_tag extends Memcached_DataObject
function blowCache($blowLast=false)
{
self::blow('notice_tag:notice_ids:%s', common_keyize($this->tag));
self::blow('notice_tag:notice_ids:%s', Cache::keyize($this->tag));
if ($blowLast) {
self::blow('notice_tag:notice_ids:%s;last', common_keyize($this->tag));
self::blow('notice_tag:notice_ids:%s;last', Cache::keyize($this->tag));
}
}

View File

@ -83,7 +83,7 @@ class Cache
$base_key = common_config('cache', 'base');
if (empty($base_key)) {
$base_key = common_keyize(common_config('site', 'name'));
$base_key = self::keyize(common_config('site', 'name'));
}
return 'statusnet:' . $base_key . ':' . $extra;

View File

@ -1798,11 +1798,6 @@ function common_cache_key($extra)
return Cache::key($extra);
}
function common_keyize($str)
{
return Cache::keyize($str);
}
function common_license_terms($uri)
{
if(preg_match('/creativecommons.org\/licenses\/([^\/]+)/', $uri, $matches)) {

View File

@ -416,7 +416,7 @@ class GeonamesPlugin extends Plugin
{
$key = 'geonames:' .
implode(',', array_keys($attrs)) . ':'.
common_keyize(implode(',', array_values($attrs)));
Cache::keyize(implode(',', array_values($attrs)));
if ($this->cachePrefix) {
return $this->cachePrefix . ':' . $key;
} else {