Move blowFavesCache() to Profile

This commit is contained in:
Zach Copley 2010-09-28 15:46:14 -07:00
parent d684a07fd9
commit 78a711d556
2 changed files with 15 additions and 10 deletions

View File

@ -552,6 +552,20 @@ class Profile extends Memcached_DataObject
return $cnt; 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() function blowSubscriberCount()
{ {
$c = common_memcache(); $c = common_memcache();

View File

@ -482,17 +482,8 @@ class User extends Memcached_DataObject
function blowFavesCache() 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 = $this->getProfile();
$profile->blowFaveCount(); $profile->blowFavesCache();
} }
function getSelfTags() function getSelfTags()