/** * Returns latest invalidation timestamp for the given $key. * * 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. * * @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; }