diff --git a/src/Netflex/Site/Cache.php b/src/Netflex/Site/Cache.php index 039223b..8be978b 100644 --- a/src/Netflex/Site/Cache.php +++ b/src/Netflex/Site/Cache.php @@ -220,10 +220,9 @@ public function purge() * @param $ttl int Cache time to live * @param $callback function A function that resolves the value if it is not already cached */ - public static function resolve($key, $ttl = 3600, $callback) - { - if (self::$cache->has($key)) { - return self::$cache->get($key); + public function resolve($key, $ttl = 3600, $callback) { + if ($this->has($key)) { + return $this->get($key); } $ttlValue = null; @@ -241,8 +240,8 @@ public static function resolve($key, $ttl = 3600, $callback) $response = $callback(); } - self::$cache->set($key, $response, '_', $ttlValue ?? $ttl); + $this->set($key, $response, '_', $ttlValue ?? $ttl); - return self::$cache->get($key); + return $this->get($key); } } diff --git a/src/Netflex/Site/Site.php b/src/Netflex/Site/Site.php index 47cea8b..1b6775b 100644 --- a/src/Netflex/Site/Site.php +++ b/src/Netflex/Site/Site.php @@ -74,10 +74,10 @@ public function loadGlobals () { public function loadPage($id, $revision) { global $_mode; - $this->content = NF::$cache->fetch('page/' . $id); + $this->content = NF::$cache->fetch("page/$id"); if ($_mode || !$this->content) { $this->loadContent($id, $revision); - NF::$cache->save('page/$id', $this->content); + NF::$cache->save("page/$id", $this->content); } }