common_log_db_error($fave, 'INSERT', __FILE__);
return false;
}
- self::blow('fave:list-ids:notice_id:%d', $fave->notice_id);
+ self::blowCacheForProfileId($fave->user_id);
+ self::blowCacheForNoticeId($fave->notice_id);
self::blow('popular');
Event::handle('EndFavorNotice', array($profile, $notice));
if (Event::handle('StartDisfavorNotice', array($profile, $notice, &$result))) {
$result = parent::delete($useWhere);
- self::blow('fave:list-ids:notice_id:%d', $this->notice_id);
+
+ self::blowCacheForProfileId($this->user_id);
+ self::blowCacheForNoticeId($this->notice_id);
self::blow('popular');
if ($result) {
$cache->delete(Cache::key('fave:count_by_profile:'.$profile_id));
}
}
+ static public function blowCacheForNoticeId($notice_id)
+ {
+ $cache = Cache::instance();
+ if ($cache) {
+ $cache->delete(Cache::key('fave:list-ids:notice_id:'.$notice_id));
+ }
+ }
}