diff options
author | Evan Prodromou <evan@status.net> | 2010-12-06 17:19:41 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-12-06 17:19:41 -0500 |
commit | bb63fd4b75181e1e9429d3a62377dab72a5c0990 (patch) | |
tree | 7c203b5a51386d72013a51a9853baabc3727a117 /lib | |
parent | 8c4e14b59c649ff38159793a1e30229bcc4bf4d6 (diff) |
Config flag to disable router caching if needed
Diffstat (limited to 'lib')
-rw-r--r-- | lib/default.php | 2 | ||||
-rw-r--r-- | lib/router.php | 20 |
2 files changed, 14 insertions, 8 deletions
diff --git a/lib/default.php b/lib/default.php index 7388046d3..029dbb390 100644 --- a/lib/default.php +++ b/lib/default.php @@ -328,4 +328,6 @@ $default = array('ssl_cafile' => false, // To enable SSL cert validation, point to a CA bundle (eg '/usr/lib/ssl/certs/ca-certificates.crt') 'curl' => false, // Use CURL backend for HTTP fetches if available. (If not, PHP's socket streams will be used.) ), + 'router' => + array('cache' => true), // whether to cache the router object. Defaults to true, turn off for devel ); diff --git a/lib/router.php b/lib/router.php index 4b1fdeb92..eff88bb46 100644 --- a/lib/router.php +++ b/lib/router.php @@ -127,15 +127,19 @@ class Router function __construct() { if (empty($this->m)) { - $k = self::cacheKey(); - $c = Cache::instance(); - $m = $c->get($k); - if (!empty($m)) { - $this->m = $m; - } else { + if (!common_config('router', 'cache')) { $this->m = $this->initialize(); - $c->set($k, $this->m); - } + } else { + $k = self::cacheKey(); + $c = Cache::instance(); + $m = $c->get($k); + if (!empty($m)) { + $this->m = $m; + } else { + $this->m = $this->initialize(); + $c->set($k, $this->m); + } + } } } |