Skip to content

Commit

Permalink
Merge pull request #9 from thiagotalma/patch-1
Browse files Browse the repository at this point in the history
Test cache before use it
  • Loading branch information
Igor Chepurnoy authored Aug 17, 2016
2 parents eb5e0c9 + eaa34f2 commit a47a3e3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions models/RouteModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ public function getAppRoutes($module = null)
}

$key = [__METHOD__, $module->getUniqueId()];
$cache = $this->cache;
$result = (($this->cache !== null) ? $this->cache->get($key) : false);

if (($result = $cache->get($key)) === false) {
if ($result === false) {
$result = [];
$this->getRouteRecursive($module, $result);
if ($cache !== null) {
$cache->set($key, $result, $this->cacheDuration, new TagDependency([
if ($this->cache !== null) {
$this->cache->set($key, $result, $this->cacheDuration, new TagDependency([
'tags' => self::CACHE_TAG
]));
}
Expand Down Expand Up @@ -280,4 +280,4 @@ protected function getActionRoutes($controller, &$result)
}
Yii::endProfile($token, __METHOD__);
}
}
}

0 comments on commit a47a3e3

Please sign in to comment.