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); $inst->query($qry);
return $inst; return $inst;
} }
$key_part = common_keyize($cls).':'.md5($qry); $key_part = Cache::keyize($cls).':'.md5($qry);
$ckey = common_cache_key($key_part); $ckey = common_cache_key($key_part);
$stored = $c->get($ckey); $stored = $c->get($ckey);

View File

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

View File

@ -40,7 +40,7 @@ class Notice_tag extends Memcached_DataObject
$ids = Notice::stream(array('Notice_tag', '_streamDirect'), $ids = Notice::stream(array('Notice_tag', '_streamDirect'),
array($tag), array($tag),
'notice_tag:notice_ids:' . common_keyize($tag), 'notice_tag:notice_ids:' . Cache::keyize($tag),
$offset, $limit); $offset, $limit);
return Notice::getStreamByIds($ids); return Notice::getStreamByIds($ids);
@ -82,9 +82,9 @@ class Notice_tag extends Memcached_DataObject
function blowCache($blowLast=false) 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) { 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'); $base_key = common_config('cache', 'base');
if (empty($base_key)) { 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; return 'statusnet:' . $base_key . ':' . $extra;

View File

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

View File

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