Remove old cache items. An item considered old if has been stored more than EXPIRATION_TIME seconds before
@protected
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];
                }
            }
        }
266842
def trim(self):
        ''''''
        now_time = time.time()

        while self._seq and self._seq[0].expire_time < now_time:
            item = self._seq.popleft()
            del self._map[item.key]

        if self._max_items:
            while self._seq and len(self._seq) > self._max_items:
                item = self._seq.popleft()
                del self._map[item.key]
63935
def cache_clean(self):
		
		now = time.time()
		keys_for_removal = collections.deque()
		for key, (_, expiration) in self.__cache.items():
			if expiration < now:
				keys_for_removal.append(key)
		for key in keys_for_removal:
			del self.__cache[key]
25998
function removeItem(itemName) {
  // TODO: Only remove used items
  if (data[itemName]) {
    data[itemName] = null;
  }
  if (localExists() && getItem(itemName)) {
    try {
      // Clear session storage
      window.sessionStorage.removeItem(itemName);
    } catch (error) {
      _logger2.default.warn({
        description: 'Error removing item from session storage', error: error,
        obj: 'storage', func: 'removeItem'
      });
    }
  }
}
3800
function () {
		return utility.iterate( cache.items, function ( v, k ) {
			if ( cache.expired( k ) ) {
				cache.expire( k, true );
			}
		});
	}
1338383
public function deleteExpired()
    {
        $cache = $this->loadCache();
        if (is_array($cache)) {
            $i = 0;
            $cache = array_map(function ($value) use (& $i) {
                if (!$this->isExpired($value['time'], $value['expire'])) {
                    ++$i;
                    return $value;
                }
            }, $cache);
            if ($i > 0) {
                $this->saveCache($cache);
            }
        }
        return $this;
    }
764529
function (item) {
		var items = this.items;
		var removed = 0;
		for (var i = 0, l = items.length; i < l; i++) {
			if (items[i] === item) {
				items.splice(i, 1);
				i--;
				removed++;
			}
		}
		return removed;
	}
772110
public void purge() {
		long startTime=System.currentTimeMillis();
		long objectPurged=0;
		
		Set<Map.Entry<String, T>> set=map.entrySet();
		
		long time=System.currentTimeMillis()-minUnactiveTime;
		
		for (Iterator<Map.Entry<String, T>> i=set.iterator();i.hasNext();){
			Map.Entry<String, T> entry=i.next();
			T object=entry.getValue();
			
			// Check if the object has to be removed from the cache
			if (object.getLastAccess()<time && object.canPurge() ){
				i.remove();
				objectPurged++;
			}
		}
		
		if (log.isInfoEnabled()){
			if (objectPurged==0){
				if (log.isDebugEnabled()){
					log.info("Cache:"+name+
							 " Purged:"+objectPurged+
							 " Time:"+(System.currentTimeMillis()-startTime));
				}
			} else {
				log.info("Cache:"+name+
						 " Purged:"+objectPurged+
						 " Time:"+(System.currentTimeMillis()-startTime));
			}
		}
		
	}
1156555
function (oldItem, newItem) {
        var ctrlElm, items = this.items(), i = items.length;

        // Replace the item in collection
        while (i--) {
          if (items[i] === oldItem) {
            items[i] = newItem;
            break;
          }
        }

        if (i >= 0) {
          // Remove new item from DOM
          ctrlElm = newItem.getEl();
          if (ctrlElm) {
            ctrlElm.parentNode.removeChild(ctrlElm);
          }

          // Remove old item from DOM
          ctrlElm = oldItem.getEl();
          if (ctrlElm) {
            ctrlElm.parentNode.removeChild(ctrlElm);
          }
        }

        // Adopt the item
        newItem.parent(this);
      }
62095
def purge_obsolete_samples(self, config, now):
        
        expire_age = config.samples * config.time_window_ms
        for sample in self._samples:
            if now - sample.last_window_ms >= expire_age:
                sample.reset(now)
295999
def _purge_expired(self):
        
        time_horizon = time.time() - self._keep_time
        new_cache = {}
        for (k, v) in self._cache.items():
            if v.timestamp > time_horizon:
                new_cache[k] = v
        self._cache = new_cache
917352
function() {
			localStorage.removeItem(constants.LOCAL_STORAGE_TEMP_RULES_KEY);
			localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_RULES_KEY);
			localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_CONTEXT_KEY);
			localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_CONTEXT_COMPONENT_KEY);
			localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_VISIBLE_COLUMN_KEY);
			localStorage.removeItem(constants.LOCAL_STORAGE_SELECTION_PRESETS_KEY);
			localStorage.removeItem(constants.LOCAL_STORAGE_CUSTOM_PRESETS_KEY);
		}
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;
                }
            }
        }
    }
249584
function(key) {
            var s = Storage.storage();
            if (s == null) {
                return false;
            }
            s.removeItem(key);
            return true;
        }
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();
        }
    }
1236743
def _cleanup(self):
        """"""
        for filename in os.listdir(self._storage_dir):
            file_path = path.join(self._storage_dir, filename)
            file_stat = os.stat(file_path)
            evaluate = max(file_stat.st_ctime, file_stat.st_mtime)
            if evaluate + self._duration < time.time():
                LOGGER.debug('Removing stale file: %s', file_path)
                os.unlink(file_path)
490090
protected void pruneCache() {
        final long expired = System.currentTimeMillis() - timeToLive;
        this.cacheMap.values().removeIf(entry -> entry.createTime < expired);
    }