X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=app%2FGithub%2FAPI%2FCall.php;h=32bf1cb0c89bd7e46aa9c0ad70727c55fb8afd06;hb=47343850bc7ab2851d1c6633b65742c43a50d02e;hp=ea9b59a70c461e7d0837e6e650c0eaf8c408e573;hpb=a2af03951ac7fbd032609d0044c0a85704b77771;p=pharext%2Fpharext.org diff --git a/app/Github/API/Call.php b/app/Github/API/Call.php index ea9b59a..32bf1cb 100644 --- a/app/Github/API/Call.php +++ b/app/Github/API/Call.php @@ -57,16 +57,11 @@ 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)) { + call_user_func_array($callback, $cached); + } else { + $this->enqueue($callback); } - - $this->enqueue($callback); return $this; } @@ -102,7 +97,7 @@ abstract class Call $args = $this->args; unset($args["fresh"]); ksort($args); - return sprintf("github:%s:%s:%s", $this->api->getToken(), $this, + return sprintf("%s:%s:%s", $this->api->getToken(), $this, new QueryString($args)); } @@ -119,7 +114,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();