From cb471e0c96143c780c14e0864d70879a6308206e Mon Sep 17 00:00:00 2001
From: Brion Vibber <brion@pobox.com>
Date: Mon, 15 Mar 2010 14:19:22 -0700
Subject: [PATCH] Blow more timeline caches on notice delete. Fixes paging on
 public and profile timelines after deleting something from the first page.

---
 classes/Notice.php | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/classes/Notice.php b/classes/Notice.php
index a704053a01..f7194e3394 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -119,6 +119,9 @@ class Notice extends Memcached_DataObject
         // NOTE: we don't clear queue items
 
         $result = parent::delete();
+
+        $this->blowOnDelete();
+        return $result;
     }
 
     /**
@@ -421,6 +424,18 @@ class Notice extends Memcached_DataObject
         $profile->blowNoticeCount();
     }
 
+    /**
+     * Clear cache entries related to this notice at delete time.
+     * Necessary to avoid breaking paging on public, profile timelines.
+     */
+    function blowOnDelete()
+    {
+        $this->blowOnInsert();
+
+        self::blow('profile:notice_ids:%d;last', $this->profile_id);
+        self::blow('public;last');
+    }
+
     /** save all urls in the notice to the db
      *
      * follow redirects and save all available file information
@@ -589,7 +604,6 @@ class Notice extends Memcached_DataObject
                               array(),
                               'public',
                               $offset, $limit, $since_id, $max_id);
-
         return Notice::getStreamByIds($ids);
     }
 
-- 
2.39.5