/*!
Expires all roles, policies and limitations cache.
350771
static function expireCache()
    {
        $http = eZHTTPTool::instance();

        $http->removeSessionVariable( 'CanInstantiateClassList' );
        $http->removeSessionVariable( 'ClassesCachedForUser' );

        // Expire user (role) cache
        eZUser::cleanupCache();
    }
1298505
function set($key, $data, $expire = 0)
    {
        return $this->connection->set($key, $data, MEMCACHE_COMPRESSED, $expire);
    }
479865
@GuardedBy("evictionLock")
  void expireAfterAccessEntries(long now) {
    if (!expiresAfterAccess()) {
      return;
    }

    expireAfterAccessEntries(accessOrderWindowDeque(), now);
    if (evicts()) {
      expireAfterAccessEntries(accessOrderProbationDeque(), now);
      expireAfterAccessEntries(accessOrderProtectedDeque(), now);
    }
  }
163337
function set($key, $value, $expire = 0)
    {
        if ($this->memcached)
        {
            return $this->cache->set($key, $value, $expire);
        }
        else
        {
            return $this->cache->set($key, $value, $this->flags, $expire);
        }
    }
1116034
private function expired($cacheId)
    {
        $item = $this->cachedItems[$cacheId];
        return (! $this->storage->exists($cacheId)) ||
               $this->timeUtil->expired($item->expiry);
    }
786784
public function update_from_expiry_info(expiry_info $info) : expired_context {
        $save = false;

        // Compare the expiredroles.
        $thisexpired = $this->get('expiredroles');
        $infoexpired = $info->get_expired_roles();

        sort($thisexpired);
        sort($infoexpired);
        if ($infoexpired != $thisexpired) {
            $this->set('expiredroles', $infoexpired);
            $save = true;
        }

        // Compare the unexpiredroles.
        $thisunexpired = $this->get('unexpiredroles');
        $infounexpired = $info->get_unexpired_roles();

        sort($thisunexpired);
        sort($infounexpired);
        if ($infounexpired != $thisunexpired) {
            $this->set('unexpiredroles', $infounexpired);
            $save = true;
        }

        if (empty($this->get('defaultexpired')) == $info->is_default_expired()) {
            $this->set('defaultexpired', (int) $info->is_default_expired());
            $save = true;
        }

        if ($save) {
            $this->set('status', self::STATUS_EXPIRED);
            $this->save();
        }

        return $this;

    }
124633
public static function create_from_expiry_info(\context $context, expiry_info $info, bool $save = true) : expired_context {
        $record = (object) [
            'contextid' => $context->id,
            'status' => self::STATUS_EXPIRED,
            'defaultexpired' => (int) $info->is_default_expired(),
        ];

        $expiredcontext = new static(0, $record);
        $expiredcontext->set('expiredroles', $info->get_expired_roles());
        $expiredcontext->set('unexpiredroles', $info->get_unexpired_roles());

        if ($save) {
            $expiredcontext->save();
        }

        return $expiredcontext;
    }
349062
public function add_expiredroles(array $roleids) : expired_context {
        $existing = $this->get('expiredroles');
        $newvalue = array_merge($existing, $roleids);

        $this->set('expiredroles', $newvalue);

        return $this;
    }
83187
public function expireSessionCookie(): void
    {
        if (ini_get('session.use_cookies')) {
            $params = session_get_cookie_params();
            setcookie(
                $this->getName(),
                '',
                $_SERVER['REQUEST_TIME'] - 42000,
                $params['path'],
                $params['domain'],
                $params['secure'],
                $params['httponly']
            );
        }
    }
344975
public static function expireCache()
    {
        $handler = eZExpiryHandler::instance();
        $handler->setTimestamp( self::CACHE_SIGNATURE, time() );
        $handler->store();

        self::$wildcardsIndex = null;
    }
632903
function update_cache_expiration( $path, $expiration = WP_FS__TIME_24_HOURS_IN_SEC, $method = 'GET', $params = array() ) {
            $this->_logger->entrance( "{$method}:{$path}:{$expiration}" );

            $cache_key = $this->get_cache_key( $path, $method, $params );

            self::$_cache->update_expiration( $cache_key, $expiration );
        }
773900
function () {
            var cache = this._cache;
            var expirationTime = ((new Date()).getTime() - this._expiresAfter * 1000);

            for (var url in cache) {
                if (cache.hasOwnProperty(url) && cache[url].age < expirationTime) {
                    delete cache[url];
                }
            }
        }
531492
function expunge()
    {
        if ($this->type == 'db' && $this->db && $this->ttl) {
            $this->db->query(
                "DELETE FROM {$this->table}"
                . " WHERE `cache_key` LIKE ?"
                . " AND `expires` < " . $this->db->now(),
                $this->prefix . '.%');
        }
    }
378465
public function getExpires()
    {
        list($key, $groupKey) = $this->getKeys(func_get_args());
        $this->engine->setGroupKey($groupKey);

        if (!$this->engine->isValid($key, true)) {
            return null;
        }

        return $this->engine->getExpires($key);
    }
294730
public static function expires($cacheloc, $cachekey)
    {
        $cacheloc = "cache_" . $cacheloc;
        if ( isset($_SESSION[$cacheloc]) ) {
            $cache_row = $_SESSION[$cacheloc];
            if ( time() >= $cache_row[2] ) { 
                unset($_SESSION[$cacheloc]);
                return false;
            }
            if ( $cache_row[0] != $cachekey ) return false;
            if ( $cache_row[0] === false ) return false;
            return $cache_row[2] - time();
        }
        return false;
    }
20828
public static function expire()
    {
        // #####################
        // Delete expired entries
        // #####################

        $query = 'DELETE FROM tx_metaseo_sitemap
                        WHERE is_blacklisted = 0
                          AND expire <= ' . (int)time();
        DatabaseUtility::exec($query);

        // #####################
        //  Deleted or
        // excluded pages
        // #####################
        $query = 'SELECT ts.uid
                    FROM tx_metaseo_sitemap ts
                         LEFT JOIN pages p
                            ON p.uid = ts.page_uid
                           AND p.deleted = 0
                           AND p.hidden = 0
                           AND p.tx_metaseo_is_exclude = 0
                           AND ' . DatabaseUtility::conditionNotIn('p.doktype', self::getDoktypeBlacklist()) . '
                   WHERE p.uid IS NULL';

        $deletedSitemapPages = DatabaseUtility::getColWithIndex($query);

        // delete pages
        if (!empty($deletedSitemapPages)) {
            $query = 'DELETE FROM tx_metaseo_sitemap
                            WHERE uid IN (' . implode(',', $deletedSitemapPages) . ')
                              AND is_blacklisted = 0';
            DatabaseUtility::exec($query);
        }
    }
204723
public function purgeExpired()
    {

        if ($this->sqlInitialized()) {
            if ($this->sql) {
                if ($this->sql->query("
                    DELETE
                        FROM `{$this->table}`
                        WHERE `expire` < NOW()
                ")) {
                    return true;
                }
            }
        }
        return false;
    }