was using Cache::get() and ::set() wrong

This commit is contained in:
Evan Prodromou 2010-11-30 14:44:16 -05:00
parent 0d99a01d74
commit af31767b63

View File

@ -128,12 +128,13 @@ class Router
{ {
if (empty($this->m)) { if (empty($this->m)) {
$k = self::cacheKey(); $k = self::cacheKey();
$m = Cache::get($k); $c = Cache::instance();
$m = $c->get($k);
if (!empty($m)) { if (!empty($m)) {
$this->m = $m; $this->m = $m;
} else { } else {
$this->m = $this->initialize(); $this->m = $this->initialize();
Cache::set($k, $this->m); $c->set($k, $this->m);
} }
} }
} }
@ -156,18 +157,18 @@ class Router
static function cacheKey() static function cacheKey()
{ {
$plugins = StatusNet::getActivePlugins(); $plugins = StatusNet::getActivePlugins();
$names = array(); $names = array();
foreach ($plugins as $plugin) { foreach ($plugins as $plugin) {
$names[] = $plugin[0]; $names[] = $plugin[0];
} }
$names = array_unique($names); $names = array_unique($names);
asort($names); asort($names);
// Unique enough. // Unique enough.
$uniq = crc32(implode(',', $names)); $uniq = crc32(implode(',', $names));
return Cache::key('router:'.STATUSNET_VERSION.':'.$uniq); return Cache::key('router:'.STATUSNET_VERSION.':'.$uniq);
} }