summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-07-14 10:38:34 -0400
committerEvan Prodromou <evan@status.net>2010-07-14 10:38:34 -0400
commitd73feb82d89d66593fd81f8bb5d10b1873fc9458 (patch)
tree416afd4a954b36b3fbe09459c79bae7599c1395a
parent453a06fff4f92a9fd34db2899c012d828c69202e (diff)
cache sitemap notice and user counts for 4h
-rw-r--r--classes/Memcached_DataObject.php4
-rw-r--r--plugins/Sitemap/Sitemap_notice_count.php4
-rw-r--r--plugins/Sitemap/Sitemap_user_count.php4
3 files changed, 8 insertions, 4 deletions
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php
index 4579f64df..a7fec365e 100644
--- a/classes/Memcached_DataObject.php
+++ b/classes/Memcached_DataObject.php
@@ -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)
diff --git a/plugins/Sitemap/Sitemap_notice_count.php b/plugins/Sitemap/Sitemap_notice_count.php
index 2a375b3e4..6e0061e97 100644
--- a/plugins/Sitemap/Sitemap_notice_count.php
+++ b/plugins/Sitemap/Sitemap_notice_count.php
@@ -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;
diff --git a/plugins/Sitemap/Sitemap_user_count.php b/plugins/Sitemap/Sitemap_user_count.php
index 64b4c3442..98dd05bfe 100644
--- a/plugins/Sitemap/Sitemap_user_count.php
+++ b/plugins/Sitemap/Sitemap_user_count.php
@@ -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;