]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
if all faves in cache, skip
authorEvan Prodromou <evan@prodromou.name>
Sat, 22 Nov 2008 19:28:57 +0000 (14:28 -0500)
committerEvan Prodromou <evan@prodromou.name>
Sat, 22 Nov 2008 19:28:57 +0000 (14:28 -0500)
darcs-hash:20081122192857-84dde-c8fcddd794a8339a53e6a0224bd07f6f86ef3896.gz

classes/User.php

index 75dd73315186d1ea9acf747c89cb3cc1a6222da4..0c0874091d2672825b63529769db28da259f7c9f 100644 (file)
@@ -281,6 +281,7 @@ class User extends Memcached_DataObject
                        # This is the stream of favorite notices, in rev chron
                        # order. This forces it into cache.
                        $faves = $this->favoriteNotices(0, NOTICE_CACHE_WINDOW);
+                       $cnt = 0;
                        
                        while ($faves->fetch()) {
                                if ($faves->id < $notice->id) {
@@ -290,8 +291,15 @@ class User extends Memcached_DataObject
                                        # If it matches a cached notice, then it's a fave
                                        return true;
                                }
+                               $cnt++;
                        }
-                       # If it's past the end of the cache window,
+                       # If we're not past the end of the cache window,
+                       # then the cache has all available faves, so this one
+                       # is not a fave.
+                       if ($cnt < NOTICE_CACHE_WINDOW) {
+                               return false;
+                       }
+                       # Otherwise, cache doesn't have all faves;
                        # fall through to the default
                }