Evicts expired elements from the {@link CacheManager}
487664
public void evictExpiredElements() {
        long evictedTotal = 0;
        final long startTime;
        final String[] cacheNames;

        if (!evictLock.tryLock()) {
            // Lock is already held, skip eviction
            return;
        }
        try {
            startTime = System.nanoTime();
            cacheNames = this.cacheManager.getCacheNames();

            for (String cacheName : cacheNames) {
                final Ehcache cache = this.cacheManager.getEhcache(cacheName);
                if (null != cache) {
                    final long preEvictSize = cache.getMemoryStoreSize();
                    final long evictStart = System.nanoTime();
                    cache.evictExpiredElements();
                    if (logger.isDebugEnabled()) {
                        final long evicted = preEvictSize - cache.getMemoryStoreSize();
                        evictedTotal += evicted;
                        logger.debug(
                                "Evicted "
                                        + evicted
                                        + " elements from cache '"
                                        + cacheName
                                        + "' in "
                                        + TimeUnit.NANOSECONDS.toMillis(
                                                System.nanoTime() - evictStart)
                                        + " ms");
                    }
                } else if (logger.isDebugEnabled()) {
                    logger.debug("No cache found with name " + cacheName);
                }
            }
        } finally {
            this.evictLock.unlock();
        }

        if (logger.isDebugEnabled()) {
            logger.debug(
                    "Evicted "
                            + evictedTotal
                            + " elements from "
                            + cacheNames.length
                            + " caches in "
                            + this.cacheManager.getName()
                            + " in "
                            + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime)
                            + " ms");
        }
    }
661658
@Override
    public void evict(Class arg0, Object arg1)
    {
        // TODO Can we use Class with ehcache
        if(isAlive())
        ehcache.remove(arg1);
    }
835465
public void expire() {
        synchronized (this) {
            expired = true;
        }
        int i = loadCount.get();
        debug(String.format("expire jar provider loader for: %s (loadCount: %d)", pluginJar, i));
        if (i <= 0) {
            try {
                close();
            } catch (IOException e) {

            }
        }
    }
125350
def delete_expired(self, expires):
        """"""
        meta = self.model._meta
        with commit_on_success():
            self.get_all_expired(expires).update(hidden=True)
            cursor = self.connection_for_write().cursor()
            cursor.execute(
                'DELETE FROM {0.db_table} WHERE hidden=%s'.format(meta),
                (True, ),
            )
1030213
private void emptyQueue() {
        if (queue == null) {
            return;
        }
        int startSize = cacheMap.size();
        while (true) {
            @SuppressWarnings("unchecked")
            CacheEntry<K,V> entry = (CacheEntry<K,V>)queue.poll();
            if (entry == null) {
                break;
            }
            K key = entry.getKey();
            if (key == null) {
                // key is null, entry has already been removed
                continue;
            }
            CacheEntry<K,V> currentEntry = cacheMap.remove(key);
            // check if the entry in the map corresponds to the expired
            // entry. If not, readd the entry
            if ((currentEntry != null) && (entry != currentEntry)) {
                cacheMap.put(key, currentEntry);
            }
        }
        if (DEBUG) {
            int endSize = cacheMap.size();
            if (startSize != endSize) {
                System.out.println("*** Expunged " + (startSize - endSize)
                        + " entries, " + endSize + " entries left");
            }
        }
    }
128373
public void actionClearCaches() throws JspException {

        OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_CLEAR_CACHES, null));

        setAction(CmsDialog.ACTION_CANCEL);
        actionCloseDialog();
    }
295753
public final void removeExpired() {
		mapLock.lock();
		Iterator<Entry<String, TimestampedCacheEntry<DOReader>>> entries = cacheMap.entrySet().iterator();
		if (entries.hasNext()) {
		    long now = System.currentTimeMillis();
		    while (entries.hasNext()) {
		        Entry<String, TimestampedCacheEntry<DOReader>> entry = entries.next();
		        TimestampedCacheEntry<DOReader> e = entry.getValue();
		        long age = e.ageAt(now);
		        if (age > (maxSeconds * 1000)) {
		            entries.remove();
		            String pid = entry.getKey();
		            LOG.debug("removing entry {} after {} milliseconds",
		                    pid, age);
		        }

		    }
		}
		mapLock.unlock();
	}
840097
public void purge() {
        long time = System.currentTimeMillis();
        if (time - latestWriteTime > expireMillis) {
            // Everything in the map is expired, clear all at once
            map.clear();
        } else {
            // Iterate and remove until the first non-expired token
            Iterator<Value> values = map.values().iterator();
            while (values.hasNext()) {
                if (time >= values.next().expire) {
                    values.remove();
                } else {
                    break;
                }
            }
        }
    }
1275132
function(event) {
      var d = event.target.ownerDocument || event.target;
      stopMutation(d);
      expireCache(d);
    }
169001
@Override public synchronized Long del(final String ... keys) {
        long deleted = 0L;
        String key;
        for (int idx = 0; idx < keys.length; idx += 1) {
            key = keys[idx];
            timers.remove(key);
            expirations.remove(key);
            for (IRedisCache cache : caches) {
                if (cache.exists(key)) {
                    cache.remove(key);
                    keyModified(key);
                    deleted += 1L;
                    break;
                }
            }
        }
        return deleted;
    }
772332
public void purgeCache() {
        synchronized (users) {
            users.values().stream()
                    .map(Reference::get)
                    .filter(Objects::nonNull)
                    .map(Cleanupable.class::cast)
                    .forEach(Cleanupable::cleanup);
            users.clear();
        }
        userIdByRef.clear();
        servers.values().stream()
                .map(Cleanupable.class::cast)
                .forEach(Cleanupable::cleanup);
        servers.clear();
        channels.values().stream()
                .filter(Cleanupable.class::isInstance)
                .map(Cleanupable.class::cast)
                .forEach(Cleanupable::cleanup);
        channels.clear();
        unavailableServers.clear();
        customEmojis.clear();
        messages.clear();
        messageIdByRef.clear();
        timeOffset = null;
    }
634373
function ExpiresDecorator(cache, config) {
  BaseDecorator.call(this, cache, config, joi.object().keys({
    expiresIn: joi.number().integer().min(0).default(Infinity),
    staleIn: joi.number().integer().min(0).default(Infinity)
  }));
  this.on('set:after', this.setCreatedAt.bind(this));
  this._store = this._getStore();
}
905088
def expire(self, time=None):
        """"""
        if time is None:
            time = self.__timer()
        root = self.__root
        curr = root.next
        links = self.__links
        cache_delitem = Cache.__delitem__
        while curr is not root and curr.expire < time:
            cache_delitem(self, curr.key)
            del links[curr.key]
            next = curr.next
            curr.unlink()
            curr = next
869009
private void cleanupLists(PrefixKey key) {
    // Remove expired list entries. Keep track of the last list removed.
    NavigableMap<PrefixKey, CacheValue<Object>> head = prefixMap.headMap(key, true).descendingMap();
    Iterator<Entry<PrefixKey, CacheValue<Object>>> headItr = head.entrySet().iterator();
    Entry<PrefixKey, CacheValue<Object>> last = null;

    while (headItr.hasNext()) {
      Entry<PrefixKey, CacheValue<Object>> entry = headItr.next();
      if (isExpired(entry.getValue()) && key.isParent(entry.getKey())) {
        last = entry;
        headItr.remove();
      }
    }

    // If a list was removed, check its contained items for expiration.
    if (last != null) {
      SortedMap<PrefixKey, CacheValue<GoogleCloudStorageItemInfo>> prefix =
          getPrefixSubMap(itemMap, last.getKey());
      prefix.entrySet().removeIf(entry -> isExpired(entry.getValue()));
    }
  }
1148433
protected synchronized boolean findAndRemoveFromGCBuffer(long expirationTime, int hashcode, int size) {
        EvictionTableEntry evt = null;
        int i;
        for (i = 0; i < garbageCollectorBuffer.size(); i++) {
            evt = (EvictionTableEntry) garbageCollectorBuffer.get(i);
            if (evt.expirationTime == expirationTime && evt.hashcode == hashcode && evt.size == size) {
                break;
            }
        }
        if (i < garbageCollectorBuffer.size()) {
            this.garbageCollectorBuffer.remove(i);
            if (evt != null) {
                cod.htod.evictionEntryPool.add(evt);
            }
            return true;
        }
        return false;
    }
575047
private function cleanExpired()
    {
        // 10% chance to clean the database of expired sessions
        if (mt_rand(1, 10) == 1) {
            $expiredTime = $this->now - $this->secondsUntilExpiration;
            $stmt = $this->db->prepare("DELETE FROM {$this->tableName} WHERE time_updated < {$expiredTime}");
            $stmt->execute();
        }
    }
403108
public void deleteExpired(IEntityLock lock) throws LockingException {
        deleteExpired(new Date(), lock.getEntityType(), lock.getEntityKey());
    }