Jarves\Cache\Cacher::isCacheIsValid PHP Method

isCacheIsValid() public method

Returns an timestamp as integer which tells the cache handler that all stored caches before this timestamp are automatically invalide. Returns null when no invalidation has set yet, means also that the cache with given key is valid.
public isCacheIsValid ( $key, $timestamp ) : integer | null
return integer | null
    public function isCacheIsValid($key, $timestamp)
    {
        $parents = explode('/', $key);
        $code = '';
        foreach ($parents as $parent) {
            $code .= $parent;
            $invalidateTime = $this->distributedCache->getInvalidate($code);
            if (null !== $invalidateTime && $invalidateTime >= $timestamp) {
                //we found a invalidation that is newer than the cache of $timestamp
                //this means this cache has been invalidated.
                return false;
            }
            $code .= '/';
        }
        return true;
    }