- function readFromCache(array &$cached = null, &$ttl = null) {
- if (empty($this->args["fresh"]) && ($cache = $this->api->getCacheStorage())) {
- $key = $this->getCacheKey();
- return $cache->get($key, $cached, $ttl);
+ function readFromCache(array &$value = null) {
+ if (!empty($this->args["fresh"])) {
+ return false;
+ }
+ if (!($cache = $this->api->getCacheStorage())) {
+ return false;
+ }
+ if (!strlen($key = $this->getCacheKey())) {
+ return false;
+ }
+ if (!$cache->get($key, $cached)) {
+ return false;
+ }
+ if (null !== $this->api->getMaxAge() && $cached->getAge() > $this->api->getMaxAge()) {
+ return false;