*/
protected $query;
- /**
- * @var array
- */
- protected $result;
-
/**
* @var \React\Promise\Deferred
*/
$this->request(),
function($response) {
try {
- $this->deferred->resolve($this->response($response));
+ $result = $this->response($response);
+ if (!($result instanceof Promise\PromiseInterface)) {
+ $this->deferred->resolve($result);
+ }
} catch (\Exception $e) {
$this->deferred->reject($e);
}
return strtolower(end($parts));
}
- /**
- * Call Client::send()
- */
- function send() {
- $this->api->getClient()->send();
- return $this->result;
- }
-
/**
* Get associated cache storage
* @param int $ttl out param of configure ttl
return false;
}
if (!$cache->get($key, $cached)) {
+ if ($cached) {
+ $this->api->getLogger()->debug(
+ sprintf("Cache-Stale: $this [TTL=%d]", $cached->getTTL()),
+ $this->args);
+ } else {
+ $this->api->getLogger()->debug("Cache-Miss: $this", $this->args);
+ }
return false;
}
if (null !== $this->api->getMaxAge() && $cached->getAge() > $this->api->getMaxAge()) {
+ $this->api->getLogger()->debug("Cache-Refresh: $this", $this->args);
return false;
}
$this->api->getLogger()->debug("Cache-Hit: $this", $this->args);
$key = $this->getCacheKey();
$cache->set($key, new Item($fresh, $ttl));
+ $this->api->getLogger()->debug("Cache-Push: $this", $this->args);
}
}
if (($cache = $this->api->getCacheStorage())) {
$key = $this->getCacheKey();
$cache->del($key);
+ $this->api->getLogger()->debug("Cache-Drop: $this", $this->args);
}
}
}