X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=app%2FGithub%2FAPI%2FCall.php;h=8b09d27f451b40a935ce97780659b0cbd3acd596;hb=7127fbd60ef118a688b5c4270ed73369b2b2424a;hp=ea9b59a70c461e7d0837e6e650c0eaf8c408e573;hpb=a2af03951ac7fbd032609d0044c0a85704b77771;p=pharext%2Fpharext.org diff --git a/app/Github/API/Call.php b/app/Github/API/Call.php index ea9b59a..8b09d27 100644 --- a/app/Github/API/Call.php +++ b/app/Github/API/Call.php @@ -57,16 +57,13 @@ abstract class Call } function __invoke(callable $callback) { - if (empty($this->args["fresh"]) && ($cache = $this->api->getCacheStorage())) { - $key = $this->getCacheKey(); - - if ($cache->get($key, $cached)) { - call_user_func_array($callback, $cached); - return $this->api->getClient(); - } + if ($this->readFromCache($cached)) { + header("X-Cache-Hit: $this", false); + call_user_func_array($callback, $cached); + } else { + header("X-Cache-Miss: $this", false); + $this->enqueue($callback); } - - $this->enqueue($callback); return $this; } @@ -119,7 +116,7 @@ abstract class Call if (isset($this->config->storage->cache->{$this}->ttl)) { $ttl = $this->config->storage->cache->{$this}->ttl; } else { - $ttl = 0; + $ttl = null; } $key = $this->getCacheKey();