From e42d2124a319e72f949fa354cc75252f32a5a6c5 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 6 Sep 2010 10:03:51 -0400 Subject: [PATCH] common_keyize() -> Cache::keyize() --- classes/Memcached_DataObject.php | 2 +- classes/Notice.php | 8 ++++---- classes/Notice_tag.php | 6 +++--- lib/cache.php | 2 +- lib/util.php | 5 ----- plugins/GeonamesPlugin.php | 2 +- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index 0c46ef2b41..1c5245b7a2 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -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); diff --git a/classes/Notice.php b/classes/Notice.php index 066e7a584f..7ca1605095 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -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(); } } diff --git a/classes/Notice_tag.php b/classes/Notice_tag.php index a5d0716a71..9ade36c34a 100644 --- a/classes/Notice_tag.php +++ b/classes/Notice_tag.php @@ -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)); } } diff --git a/lib/cache.php b/lib/cache.php index c09a1dd9f2..17cc5f0472 100644 --- a/lib/cache.php +++ b/lib/cache.php @@ -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; diff --git a/lib/util.php b/lib/util.php index a5e29a7818..f1ca009b4e 100644 --- a/lib/util.php +++ b/lib/util.php @@ -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)) { diff --git a/plugins/GeonamesPlugin.php b/plugins/GeonamesPlugin.php index c81fb46771..dd882715ba 100644 --- a/plugins/GeonamesPlugin.php +++ b/plugins/GeonamesPlugin.php @@ -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 {