From 78a711d5566e7bf2347199f034641f44b36f6e09 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 28 Sep 2010 15:46:14 -0700 Subject: [PATCH] Move blowFavesCache() to Profile --- classes/Profile.php | 14 ++++++++++++++ classes/User.php | 11 +---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/classes/Profile.php b/classes/Profile.php index 1a54489ed8..9753b278ec 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -552,6 +552,20 @@ class Profile extends Memcached_DataObject return $cnt; } + function blowFavesCache() + { + $cache = common_memcache(); + if ($cache) { + // Faves don't happen chronologically, so we need to blow + // ;last cache, too + $cache->delete(common_cache_key('fave:ids_by_user:'.$this->id)); + $cache->delete(common_cache_key('fave:ids_by_user:'.$this->id.';last')); + $cache->delete(common_cache_key('fave:ids_by_user_own:'.$this->id)); + $cache->delete(common_cache_key('fave:ids_by_user_own:'.$this->id.';last')); + } + $this->blowFaveCount(); + } + function blowSubscriberCount() { $c = common_memcache(); diff --git a/classes/User.php b/classes/User.php index 27299e62e0..e784fd9e9a 100644 --- a/classes/User.php +++ b/classes/User.php @@ -482,17 +482,8 @@ class User extends Memcached_DataObject function blowFavesCache() { - $cache = common_memcache(); - if ($cache) { - // Faves don't happen chronologically, so we need to blow - // ;last cache, too - $cache->delete(common_cache_key('fave:ids_by_user:'.$this->id)); - $cache->delete(common_cache_key('fave:ids_by_user:'.$this->id.';last')); - $cache->delete(common_cache_key('fave:ids_by_user_own:'.$this->id)); - $cache->delete(common_cache_key('fave:ids_by_user_own:'.$this->id.';last')); - } $profile = $this->getProfile(); - $profile->blowFaveCount(); + $profile->blowFavesCache(); } function getSelfTags()