private static function isValidKey()

in app/classes/Cache/Cache.php [185:203]


    private static function isValidKey(string $id, int $ttl): bool
    {
        $immutable = ($ttl === -1) ? true : false;

        // No cache file
        if (! file_exists(self::getKeyPath($id, $immutable))) {
            return false;
        }

        // Cache is obsolete and was deleted
        if (self::isObsoleteKey($id, $ttl)) {
            self::deleteKey($id);

            return false;
        }

        // All good, cache is valid
        return true;
    }