public function tryFetch($id, $maxLifetimeSeconds = null)
    {
        $entry = $this->storage->tryFetch($id);

        if (null === $entry) {
            return null;
        }

        if (null !== $maxLifetimeSeconds) {
            if (($this->nowTimestamp - $entry->creationTimestamp()) > $maxLifetimeSeconds) {
                return null;
            }
        }

        if (null !== $entry->expirationTimestamp()) {
            if ($this->nowTimestamp > $entry->expirationTimestamp()) {
                return null;
            }
        }

        return $entry->data();
    }
public function tryFetch($id, $maxLifetimeSeconds = null)
    {
        $entry = $this->storage->tryFetch($id);

        if (null === $entry) {
            return null;
        }

        if (null !== $maxLifetimeSeconds) {
            if (($this->nowTimestamp - $entry->creationTimestamp()) > $maxLifetimeSeconds) {
                return null;
            }
        }

        if (null !== $entry->expirationTimestamp()) {
            if ($this->nowTimestamp > $entry->expirationTimestamp()) {
                return null;
            }
        }

        return $entry->data();
    }
public function tryFetch ( $ id , $ maxLifetimeSeconds = null ) { $ entry = $ this -> storage -> tryFetch ( $ id ) ; if ( null === $ entry ) { return null ; } if ( null !== $ maxLifetimeSeconds ) { if ( ( $ this -> nowTimestamp - $ entry -> creationTimestamp ( ) ) > $ maxLifetimeSeconds ) { return null ; } } if ( null !== $ entry -> expirationTimestamp ( ) ) { if ( $ this -> nowTimestamp > $ entry -> expirationTimestamp ( ) ) { return null ; } } return $ entry -> data ( ) ; }
Attempts to retrieve data from cache.

@param mixed $id Cache entry unique identifier (ex: "123").
@param null|int $maxLifetimeSeconds Duration in seconds. If provided, will bypass expiration timestamp
in cache file, using creation timestamp + provided duration to check whether cached content has
expired or not.
@return null|mixed
Attempts to retrieve data from cache .