diff options
author | Evan Prodromou <evan@status.net> | 2010-09-06 09:56:45 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-09-06 09:56:45 -0400 |
commit | 8f81762d68ede590e53b929c77602f0e2db0ddc2 (patch) | |
tree | d0b95b57e16e3ad5a478bc6f6118d734badc3ddb | |
parent | 6fe2429c4191bd4b7de8c7a512dfbf78571ddbaf (diff) |
common_memcache() => Cache::instance()
-rw-r--r-- | actions/getfile.php | 2 | ||||
-rw-r--r-- | classes/Memcached_DataObject.php | 2 | ||||
-rw-r--r-- | classes/Notice.php | 6 | ||||
-rw-r--r-- | classes/Profile.php | 16 | ||||
-rw-r--r-- | classes/User.php | 4 | ||||
-rw-r--r-- | lib/spawningdaemon.php | 2 | ||||
-rw-r--r-- | lib/stompqueuemanager.php | 2 | ||||
-rw-r--r-- | lib/util.php | 24 | ||||
-rw-r--r-- | plugins/GeonamesPlugin.php | 4 | ||||
-rw-r--r-- | plugins/LdapCommon/LdapCommon.php | 2 | ||||
-rw-r--r-- | plugins/Minify/MinifyPlugin.php | 4 | ||||
-rw-r--r-- | plugins/Minify/minify.php | 2 | ||||
-rw-r--r-- | scripts/clearcache.php | 2 | ||||
-rwxr-xr-x | scripts/fixup_inboxes.php | 2 | ||||
-rw-r--r-- | scripts/showcache.php | 2 | ||||
-rw-r--r-- | scripts/uncache_users.php | 2 |
16 files changed, 36 insertions, 42 deletions
diff --git a/actions/getfile.php b/actions/getfile.php index 9cbe8e1d9..17cca13f4 100644 --- a/actions/getfile.php +++ b/actions/getfile.php @@ -129,7 +129,7 @@ class GetfileAction extends Action return null; } - $cache = common_memcache(); + $cache = Cache::instance(); if($cache) { $key = common_cache_key('attachments:etag:' . $this->path); $etag = $cache->get($key); diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index 0f1ed0489..0c46ef2b4 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -124,7 +124,7 @@ class Memcached_DataObject extends Safe_DataObject } static function memcache() { - return common_memcache(); + return Cache::instance(); } static function cacheKey($cls, $k, $v) { diff --git a/classes/Notice.php b/classes/Notice.php index 14477b1b5..066e7a584 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -591,7 +591,7 @@ class Notice extends Memcached_DataObject function getStreamByIds($ids) { - $cache = common_memcache(); + $cache = Cache::instance(); if (!empty($cache)) { $notices = array(); @@ -1585,7 +1585,7 @@ class Notice extends Memcached_DataObject function stream($fn, $args, $cachekey, $offset=0, $limit=20, $since_id=0, $max_id=0) { - $cache = common_memcache(); + $cache = Cache::instance(); if (empty($cache) || $since_id != 0 || $max_id != 0 || @@ -1777,7 +1777,7 @@ class Notice extends Memcached_DataObject function repeatStream($limit=100) { - $cache = common_memcache(); + $cache = Cache::instance(); if (empty($cache)) { $ids = $this->_repeatStreamDirect($limit); diff --git a/classes/Profile.php b/classes/Profile.php index 8f8679550..19564408c 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -429,7 +429,7 @@ class Profile extends Memcached_DataObject function subscriptionCount() { - $c = common_memcache(); + $c = Cache::instance(); if (!empty($c)) { $cnt = $c->get(common_cache_key('profile:subscription_count:'.$this->id)); @@ -454,7 +454,7 @@ class Profile extends Memcached_DataObject function subscriberCount() { - $c = common_memcache(); + $c = Cache::instance(); if (!empty($c)) { $cnt = $c->get(common_cache_key('profile:subscriber_count:'.$this->id)); if (is_integer($cnt)) { @@ -476,7 +476,7 @@ class Profile extends Memcached_DataObject function faveCount() { - $c = common_memcache(); + $c = Cache::instance(); if (!empty($c)) { $cnt = $c->get(common_cache_key('profile:fave_count:'.$this->id)); if (is_integer($cnt)) { @@ -497,7 +497,7 @@ class Profile extends Memcached_DataObject function noticeCount() { - $c = common_memcache(); + $c = Cache::instance(); if (!empty($c)) { $cnt = $c->get(common_cache_key('profile:notice_count:'.$this->id)); @@ -519,7 +519,7 @@ class Profile extends Memcached_DataObject function blowSubscriberCount() { - $c = common_memcache(); + $c = Cache::instance(); if (!empty($c)) { $c->delete(common_cache_key('profile:subscriber_count:'.$this->id)); } @@ -527,7 +527,7 @@ class Profile extends Memcached_DataObject function blowSubscriptionCount() { - $c = common_memcache(); + $c = Cache::instance(); if (!empty($c)) { $c->delete(common_cache_key('profile:subscription_count:'.$this->id)); } @@ -535,7 +535,7 @@ class Profile extends Memcached_DataObject function blowFaveCount() { - $c = common_memcache(); + $c = Cache::instance(); if (!empty($c)) { $c->delete(common_cache_key('profile:fave_count:'.$this->id)); } @@ -543,7 +543,7 @@ class Profile extends Memcached_DataObject function blowNoticeCount() { - $c = common_memcache(); + $c = Cache::instance(); if (!empty($c)) { $c->delete(common_cache_key('profile:notice_count:'.$this->id)); } diff --git a/classes/User.php b/classes/User.php index 70e09c1dc..36db22612 100644 --- a/classes/User.php +++ b/classes/User.php @@ -388,7 +388,7 @@ class User extends Memcached_DataObject function hasFave($notice) { - $cache = common_memcache(); + $cache = Cache::instance(); // XXX: Kind of a hack. @@ -487,7 +487,7 @@ class User extends Memcached_DataObject function blowFavesCache() { - $cache = common_memcache(); + $cache = Cache::instance(); if ($cache) { // Faves don't happen chronologically, so we need to blow // ;last cache, too diff --git a/lib/spawningdaemon.php b/lib/spawningdaemon.php index 2f9f6e32e..ea09b6fb2 100644 --- a/lib/spawningdaemon.php +++ b/lib/spawningdaemon.php @@ -204,7 +204,7 @@ abstract class SpawningDaemon extends Daemon // Reconnect main memcached, or threads will stomp on // each other and corrupt their requests. - $cache = common_memcache(); + $cache = Cache::instance(); if ($cache) { $cache->reconnect(); } diff --git a/lib/stompqueuemanager.php b/lib/stompqueuemanager.php index fc98c77d4..1d9a5ad20 100644 --- a/lib/stompqueuemanager.php +++ b/lib/stompqueuemanager.php @@ -578,7 +578,7 @@ class StompQueueManager extends QueueManager function incDeliveryCount($msgId) { $count = 0; - $cache = common_memcache(); + $cache = Cache::instance(); if ($cache) { $key = 'statusnet:stomp:message-retries:' . $msgId; $count = $cache->increment($key); diff --git a/lib/util.php b/lib/util.php index b7d3c80ca..d56c9124d 100644 --- a/lib/util.php +++ b/lib/util.php @@ -37,7 +37,7 @@ function common_user_error($msg, $code=400) /** * This should only be used at setup; processes switching languages * to send text to other users should use common_switch_locale(). - * + * * @param string $language Locale language code (optional; empty uses * current user's preference or site default) * @return mixed success @@ -61,10 +61,10 @@ function common_init_locale($language=null) /** * Initialize locale and charset settings and gettext with our message catalog, * using the current user's language preference or the site default. - * + * * This should generally only be run at framework initialization; code switching * languages at runtime should call common_switch_language(). - * + * * @access private */ function common_init_language() @@ -142,7 +142,6 @@ function common_switch_locale($language=null) textdomain("statusnet"); } - function common_timezone() { if (common_logged_in()) { @@ -1361,13 +1360,13 @@ function common_mtrand($bytes) /** * Record the given URL as the return destination for a future * form submission, to be read by common_get_returnto(). - * + * * @param string $url - * + * * @fixme as a session-global setting, this can allow multiple forms * to conflict and overwrite each others' returnto destinations if * the user has multiple tabs or windows open. - * + * * Should refactor to index with a token or otherwise only pass the * data along its intended path. */ @@ -1380,13 +1379,13 @@ function common_set_returnto($url) /** * Fetch a return-destination URL previously recorded by * common_set_returnto(). - * + * * @return mixed URL string or null - * + * * @fixme as a session-global setting, this can allow multiple forms * to conflict and overwrite each others' returnto destinations if * the user has multiple tabs or windows open. - * + * * Should refactor to index with a token or otherwise only pass the * data along its intended path. */ @@ -1809,11 +1808,6 @@ function common_keyize($str) return Cache::keyize($str); } -function common_memcache() -{ - return Cache::instance(); -} - function common_license_terms($uri) { if(preg_match('/creativecommons.org\/licenses\/([^\/]+)/', $uri, $matches)) { diff --git a/plugins/GeonamesPlugin.php b/plugins/GeonamesPlugin.php index 3815a31fa..c81fb4677 100644 --- a/plugins/GeonamesPlugin.php +++ b/plugins/GeonamesPlugin.php @@ -384,7 +384,7 @@ class GeonamesPlugin extends Plugin function getCache($attrs) { - $c = common_memcache(); + $c = Cache::instance(); if (empty($c)) { return null; @@ -399,7 +399,7 @@ class GeonamesPlugin extends Plugin function setCache($attrs, $loc) { - $c = common_memcache(); + $c = Cache::instance(); if (empty($c)) { return null; diff --git a/plugins/LdapCommon/LdapCommon.php b/plugins/LdapCommon/LdapCommon.php index 1f1647a75..f53660a4c 100644 --- a/plugins/LdapCommon/LdapCommon.php +++ b/plugins/LdapCommon/LdapCommon.php @@ -126,7 +126,7 @@ class LdapCommon } throw new Exception('Could not connect to LDAP server: '.$err->getMessage()); } - $c = common_memcache(); + $c = Cache::instance(); if (!empty($c)) { $cacheObj = new MemcacheSchemaCache( array('c'=>$c, diff --git a/plugins/Minify/MinifyPlugin.php b/plugins/Minify/MinifyPlugin.php index 13010e75a..5071fd5a1 100644 --- a/plugins/Minify/MinifyPlugin.php +++ b/plugins/Minify/MinifyPlugin.php @@ -119,7 +119,7 @@ class MinifyPlugin extends Plugin function onStartInlineScriptElement($action,&$code,&$type) { if($this->minifyInlineJs && $type=='text/javascript'){ - $c = common_memcache(); + $c = Cache::instance(); if (!empty($c)) { $cacheKey = common_cache_key(self::cacheKey . ':' . crc32($code)); $out = $c->get($cacheKey); @@ -139,7 +139,7 @@ class MinifyPlugin extends Plugin function onStartStyleElement($action,&$code,&$type,&$media) { if($this->minifyInlineCss && $type=='text/css'){ - $c = common_memcache(); + $c = Cache::instance(); if (!empty($c)) { $cacheKey = common_cache_key(self::cacheKey . ':' . crc32($code)); $out = $c->get($cacheKey); diff --git a/plugins/Minify/minify.php b/plugins/Minify/minify.php index 64727f5e7..3e8f86f83 100644 --- a/plugins/Minify/minify.php +++ b/plugins/Minify/minify.php @@ -74,7 +74,7 @@ class MinifyAction extends Action { parent::handle($args); - $c = common_memcache(); + $c = Cache::instance(); if (!empty($c)) { $cacheKey = common_cache_key(MinifyPlugin::cacheKey . ':' . $this->file . '?v=' . empty($this->v)?'':$this->v); $out = $c->get($cacheKey); diff --git a/scripts/clearcache.php b/scripts/clearcache.php index 0fb75daa0..8f54bc9ac 100644 --- a/scripts/clearcache.php +++ b/scripts/clearcache.php @@ -55,7 +55,7 @@ if (!empty($karg)) { print "Clearing key '$k'..."; -$c = common_memcache(); +$c = Cache::instance(); if (empty($c)) { die("Can't initialize cache object!\n"); diff --git a/scripts/fixup_inboxes.php b/scripts/fixup_inboxes.php index d55a53885..7397d75d8 100755 --- a/scripts/fixup_inboxes.php +++ b/scripts/fixup_inboxes.php @@ -46,7 +46,7 @@ if ($start_at) { } $cnt = $user->find(); -$cache = common_memcache(); +$cache = Cache::instance(); while ($user->fetch()) { common_log(LOG_INFO, 'Updating inbox for user ' . $user->id); diff --git a/scripts/showcache.php b/scripts/showcache.php index 93b57a484..953ad1a77 100644 --- a/scripts/showcache.php +++ b/scripts/showcache.php @@ -55,7 +55,7 @@ if (!empty($karg)) { print "Checking key '$k'...\n"; -$c = common_memcache(); +$c = Cache::instance(); if (empty($c)) { die("Can't initialize cache object!\n"); diff --git a/scripts/uncache_users.php b/scripts/uncache_users.php index 5a1d33030..d8c0a025b 100644 --- a/scripts/uncache_users.php +++ b/scripts/uncache_users.php @@ -34,7 +34,7 @@ common_log(LOG_INFO, 'Updating user inboxes.'); $ids = file($id_file); -$memc = common_memcache(); +$memc = Cache::instance(); foreach ($ids as $id) { |