]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
cache sitemap notice and user counts for 4h
authorEvan Prodromou <evan@status.net>
Wed, 14 Jul 2010 14:38:34 +0000 (10:38 -0400)
committerEvan Prodromou <evan@status.net>
Wed, 14 Jul 2010 14:38:34 +0000 (10:38 -0400)
classes/Memcached_DataObject.php
plugins/Sitemap/Sitemap_notice_count.php
plugins/Sitemap/Sitemap_user_count.php

index 4579f64df8ec21ce05a2a34e4ecca522ba4407dc..a7fec365e0219bdd23d72b321dd0012b66dee78f 100644 (file)
@@ -593,7 +593,7 @@ class Memcached_DataObject extends Safe_DataObject
         return $c->get($cacheKey);
     }
 
-    static function cacheSet($keyPart, $value)
+    static function cacheSet($keyPart, $value, $flag=null, $expiry=null)
     {
         $c = self::memcache();
 
@@ -603,7 +603,7 @@ class Memcached_DataObject extends Safe_DataObject
 
         $cacheKey = common_cache_key($keyPart);
 
-        return $c->set($cacheKey, $value);
+        return $c->set($cacheKey, $value, $flag, $expiry);
     }
 
     static function valueString($v)
index 2a375b3e48a35ecd821691116251b31a88b526bf..6e0061e97b083d5c07dd7ca7769f3a8e0fe49e06 100644 (file)
@@ -153,7 +153,9 @@ class Sitemap_notice_count extends Memcached_DataObject
                 $noticeCounts[$snc->notice_date] = $snc->notice_count;
             }
 
-            self::cacheSet('sitemap:notice:counts', $noticeCounts);
+            // Cache notice counts for 4 hours.
+
+            self::cacheSet('sitemap:notice:counts', $noticeCounts, null, time() + 4 * 60 * 60);
         }
 
         return $noticeCounts;
index 64b4c34428bf904321f2e5f119dda6890f29001f..98dd05bfed32104f0cb80f032ae1d845184bf289 100644 (file)
@@ -154,7 +154,9 @@ class Sitemap_user_count extends Memcached_DataObject
                 $userCounts[$suc->registration_date] = $suc->user_count;
             }
 
-            self::cacheSet('sitemap:user:counts', $userCounts);
+            // Cache user counts for 4 hours.
+
+            self::cacheSet('sitemap:user:counts', $userCounts, null, time() + 4 * 60 * 60);
         }
 
         return $userCounts;