blow last caches on notice delete
We do some extra caching of streams, at ';last'. If a notice is deleted, we need to blow those caches, too. So, this deletes them. darcs-hash:20081124003240-84dde-aa4561e5e68b0ccc0598ac86294ea54f9be5775a.gz
This commit is contained in:
parent
45f5ef8c87
commit
577b54c2af
|
@ -58,8 +58,8 @@ class Notice extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete() {
|
function delete() {
|
||||||
$this->blowCaches();
|
$this->blowCaches(true);
|
||||||
$this->blowFavesCache();
|
$this->blowFavesCache(true);
|
||||||
$this->blowInboxes();
|
$this->blowInboxes();
|
||||||
parent::delete();
|
parent::delete();
|
||||||
}
|
}
|
||||||
|
@ -137,15 +137,15 @@ class Notice extends Memcached_DataObject
|
||||||
return $notice;
|
return $notice;
|
||||||
}
|
}
|
||||||
|
|
||||||
function blowCaches() {
|
function blowCaches($blowLast=false) {
|
||||||
$this->blowSubsCache();
|
$this->blowSubsCache($blowLast);
|
||||||
$this->blowNoticeCache();
|
$this->blowNoticeCache($blowLast);
|
||||||
$this->blowRepliesCache();
|
$this->blowRepliesCache($blowLast);
|
||||||
$this->blowPublicCache();
|
$this->blowPublicCache($blowLast);
|
||||||
$this->blowTagCache();
|
$this->blowTagCache($blowLast);
|
||||||
}
|
}
|
||||||
|
|
||||||
function blowTagCache() {
|
function blowTagCache($blowLast=false) {
|
||||||
$cache = common_memcache();
|
$cache = common_memcache();
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
$tag = new Notice_tag();
|
$tag = new Notice_tag();
|
||||||
|
@ -153,6 +153,9 @@ class Notice extends Memcached_DataObject
|
||||||
if ($tag->find()) {
|
if ($tag->find()) {
|
||||||
while ($tag->fetch()) {
|
while ($tag->fetch()) {
|
||||||
$cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag));
|
$cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag));
|
||||||
|
if ($blowLast) {
|
||||||
|
$cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag . ';last'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tag->free();
|
$tag->free();
|
||||||
|
@ -160,7 +163,7 @@ class Notice extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function blowSubsCache() {
|
function blowSubsCache($blowLast=false) {
|
||||||
$cache = common_memcache();
|
$cache = common_memcache();
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
$user = new User();
|
$user = new User();
|
||||||
|
@ -171,23 +174,28 @@ class Notice extends Memcached_DataObject
|
||||||
|
|
||||||
while ($user->fetch()) {
|
while ($user->fetch()) {
|
||||||
$cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
|
$cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
|
||||||
|
if ($blowLast) {
|
||||||
|
$cache->delete(common_cache_key('user:notices_with_friends:' . $user->id . ';last'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->free();
|
$user->free();
|
||||||
unset($user);
|
unset($user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function blowNoticeCache() {
|
function blowNoticeCache($blowLast=false) {
|
||||||
if ($this->is_local) {
|
if ($this->is_local) {
|
||||||
$cache = common_memcache();
|
$cache = common_memcache();
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
$cache->delete(common_cache_key('user:notices:'.$this->profile_id));
|
$cache->delete(common_cache_key('user:notices:'.$this->profile_id));
|
||||||
|
if ($blowLast) {
|
||||||
|
$cache->delete(common_cache_key('user:notices:'.$this->profile_id.';last'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function blowRepliesCache() {
|
function blowRepliesCache($blowLast=false) {
|
||||||
$cache = common_memcache();
|
$cache = common_memcache();
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
$reply = new Reply();
|
$reply = new Reply();
|
||||||
|
@ -195,6 +203,9 @@ class Notice extends Memcached_DataObject
|
||||||
if ($reply->find()) {
|
if ($reply->find()) {
|
||||||
while ($reply->fetch()) {
|
while ($reply->fetch()) {
|
||||||
$cache->delete(common_cache_key('user:replies:'.$reply->profile_id));
|
$cache->delete(common_cache_key('user:replies:'.$reply->profile_id));
|
||||||
|
if ($blowLast) {
|
||||||
|
$cache->delete(common_cache_key('user:replies:'.$reply->profile_id.';last'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$reply->free();
|
$reply->free();
|
||||||
|
@ -202,16 +213,19 @@ class Notice extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function blowPublicCache() {
|
function blowPublicCache($blowLast=false) {
|
||||||
if ($this->is_local) {
|
if ($this->is_local) {
|
||||||
$cache = common_memcache();
|
$cache = common_memcache();
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
$cache->delete(common_cache_key('public'));
|
$cache->delete(common_cache_key('public'));
|
||||||
|
if ($blowLast) {
|
||||||
|
$cache->delete(common_cache_key('public').';last');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function blowFavesCache() {
|
function blowFavesCache($blowLast=false) {
|
||||||
$cache = common_memcache();
|
$cache = common_memcache();
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
$fave = new Fave();
|
$fave = new Fave();
|
||||||
|
@ -219,6 +233,9 @@ class Notice extends Memcached_DataObject
|
||||||
if ($fave->find()) {
|
if ($fave->find()) {
|
||||||
while ($fave->fetch()) {
|
while ($fave->fetch()) {
|
||||||
$cache->delete(common_cache_key('user:faves:'.$fave->user_id));
|
$cache->delete(common_cache_key('user:faves:'.$fave->user_id));
|
||||||
|
if ($blowLast) {
|
||||||
|
$cache->delete(common_cache_key('user:faves:'.$fave->user_id.';last'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fave->free();
|
$fave->free();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user