Purges the errorCounter map of expired entries
@param epochMinute The current time
174335
public void purgeCounters(final long epochMinute)
    {
    	for (Iterator<Map.Entry<String, MinuteCounter>> it = errorCounter.entrySet().iterator(); it.hasNext(); ) {
    		Map.Entry<String, MinuteCounter> entry = it.next();
    		
    		if (entry.getValue().getEpochMinute() < epochMinute) {
    			it.remove();
    		}
    	}
    }
1018912
@Override
    @Transactional(MillJpaRepoConfig.TRANSACTION_MANAGER_BEAN)
    public void purgeExpired() {
        log.info("flushing all written log entries over {} days old.", ageInDaysOfPurgeableWrittenLogEntries);

        Calendar c = Calendar.getInstance();
        c.add(Calendar.DATE, ageInDaysOfPurgeableWrittenLogEntries * -1);
        Date date = c.getTime();
        long deleted = this.repo.deleteByWrittenTrueAndTimestampLessThan(date.getTime());
        log.info("successfully deleted {} audit log entries that had been written and were timestamped before {}",
                 deleted, date);

    }
152853
private void pruneIfNeeded(int neededSpace) {
        if ((mTotalSize + neededSpace) < mMaxCacheSizeInBytes) {
            return;
        }
        if (VolleyLog.DEBUG) {
            VolleyLog.v("Pruning old cache entries.");
        }

        long before = mTotalSize;
        int prunedFiles = 0;
        long startTime = System.currentTimeMillis();

        Iterator<Map.Entry<String, CacheHeader>> iterator = mEntries.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry<String, CacheHeader> entry = iterator.next();
            CacheHeader e = entry.getValue();
            boolean deleted = getFileForKey(e.key).delete();
            if (deleted) {
                mTotalSize -= e.size;
            } else {
               VolleyLog.d("Could not delete cache entry for key=%s, filename=%s",
                       e.key, getFilenameForKey(e.key));
            }
            iterator.remove();
            prunedFiles++;

            if ((mTotalSize + neededSpace) < mMaxCacheSizeInBytes * HYSTERESIS_FACTOR) {
                break;
            }
        }

        if (VolleyLog.DEBUG) {
            VolleyLog.v("pruned %d files, %d bytes, %d ms",
                    prunedFiles, (mTotalSize - before), System.currentTimeMillis() - startTime);
        }
    }
566850
def delete_expired_locks(self):
        
        ttl_seconds = self.get_mutex_ttl_seconds()
        if ttl_seconds is not None:
            DBMutex.objects.filter(creation_time__lte=timezone.now() - timedelta(seconds=ttl_seconds)).delete()
115100
def _purge_expired(self):
        
        time_horizon = time.time() - self._keep_time
        new_cache = {}
        dec_count_for = []
        for (k, v) in self._cache.items():
            if v.count > 0:
                if k not in self._block_store:
                    new_cache[k] = v
                else:
                    if v.timestamp > time_horizon:
                        new_cache[k] = v
                    else:
                        block = v.value
                        if block is not None:
                            dec_count_for.append(block.previous_block_id)

            elif v.timestamp > time_horizon:
                new_cache[k] = v

            else:
                block = v.value
                # Handle NULL_BLOCK_IDENTIFIER
                if block is not None:
                    dec_count_for.append(block.previous_block_id)

        self._cache = new_cache
        for block_id in dec_count_for:
            if block_id in self._cache:
                self._cache[block_id].dec_count()
152702
private void cleanup() {
        if ((++counter & 0xFF) != 0) { // (++counter % 256) != 0
            return;
        }

        final long currentTimeNanos = System.nanoTime();
        if (currentTimeNanos - lastCleanupTimeNanos < CLEANUP_INTERVAL_NANOS) {
            return;
        }

        for (final Iterator<State> i = map.values().iterator(); i.hasNext();) {
            final State state = i.next();
            final boolean remove;

            synchronized (state) {
                remove = state.allActiveRequests == 0 &&
                         currentTimeNanos - state.lastActivityTimeNanos >= CLEANUP_INTERVAL_NANOS;
            }

            if (remove) {
                i.remove();
            }
        }

        lastCleanupTimeNanos = System.nanoTime();
    }
74035
public int incrementCounter(final StackifyError error, long epochMinute) {
		if (error == null) {
			throw new NullPointerException("StackifyError is null");
		}

        ErrorItem baseError = getBaseError(error);
    	String uniqueKey = getUniqueKey(baseError);

        // get the counter for this error
    	
    	int count = 0;

        if (errorCounter.containsKey(uniqueKey)) {
        	
            // counter exists

        	MinuteCounter counter = errorCounter.get(uniqueKey);

            if (counter.getEpochMinute() == epochMinute) {
                // counter exists for this current minute
                // increment the counter
            	MinuteCounter incCounter = MinuteCounter.incrementCounter(counter);
            	errorCounter.put(uniqueKey, incCounter);
            	count = incCounter.getErrorCount();
            } else {
                // counter did not exist for this minute
            	// overwrite the entry with a new one
            	MinuteCounter newCounter = MinuteCounter.newMinuteCounter(epochMinute);
            	errorCounter.put(uniqueKey, newCounter);
            	count = newCounter.getErrorCount();
            }
        } else {
            // counter did not exist so create a new one
        	MinuteCounter newCounter = MinuteCounter.newMinuteCounter(epochMinute);
        	errorCounter.put(uniqueKey, newCounter);
        	count = newCounter.getErrorCount();
        }
        
        return count;
    }
754792
private void cleanUsingTime(final String metricName, final Date firstAllowedDate) {
    if (this.historyListMapping.containsKey(metricName)
        && this.historyListMapping.get(metricName) != null) {
      synchronized (this.historyListMapping.get(metricName)) {

        InMemoryHistoryNode firstNode = this.historyListMapping.get(metricName).peekFirst();
        long localCopyOfTimeWindow = 0;

        // go ahead for clean up using latest possible value of interval
        // any interval change will not affect on going clean up
        synchronized (this) {
          localCopyOfTimeWindow = this.timeWindow;
        }

        // removing objects older than Interval time from firstAllowedDate
        while (firstNode != null
            && TimeUnit.MILLISECONDS
            .toMillis(firstAllowedDate.getTime() - firstNode.getTimestamp().getTime())
            > localCopyOfTimeWindow) {
          this.historyListMapping.get(metricName).removeFirst();
          firstNode = this.historyListMapping.get(metricName).peekFirst();
        }
      }
    }
  }
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;
    }
1234261
def _expire(self):
        
        del self.map.addr[self.name]
        self.map.notify("addrmap_expired", *[self.name], **{})
1272536
private function autoPruneExpiredEntries()
    {
        if (0 === $this->options['prune_threshold']) {
            return;
        }

        $item = $this->cache->getItem(self::COUNTER_KEY);
        $counter = (int) $item->get();

        if ($counter > $this->options['prune_threshold']) {
            $this->prune();
            $counter = 0;
        } else {
            ++$counter;
        }

        $item->set($counter);

        $this->cache->saveDeferred($item);
    }
949564
private void cleanup() {
		CacheEntry oldest = null;
		_count = 0;

		// Cleanup obsolete entries and find the oldest
		for (Map.Entry<String, CacheEntry> e : _cache.entrySet()) {
			String key = e.getKey();
			CacheEntry entry = e.getValue();
			// Remove obsolete entry
			if (entry.isExpired()) {
				_cache.remove(key);
			}
			// Count the remaining entry
			else {
				_count++;
				if (oldest == null || oldest.getExpiration() > entry.getExpiration())
					oldest = entry;
			}
		}

		// Remove the oldest if cache size exceeded maximum
		if (_count > _maxSize && oldest != null) {
			_cache.remove(oldest.getKey());
			_count--;
		}
	}
220036
public void purge(Instant limit) {
		Instant firstKeeper = values.floorKey(limit);
		if (firstKeeper == null) return;
		Set<Instant> purgables = values.headMap(firstKeeper).keySet();
		if (purgables == null) return;
		for (Instant purgable : purgables) {
			values.remove(purgable);
		}
	}
96726
private void startPurgeTimer() {
        if (null != this.future || null == this.scheduler) {
            return;
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Creating repeating purge event");
        }
        this.future = this.scheduler.schedule(SessionEventHandler.PURGE_EVENT, this.purgeInterval, this.purgeInterval, TimeUnit.SECONDS);
    }
921945
private void deleteTimes() throws IfmapErrorResult, IfmapException {
		String filter = IfmapStrings.OP_METADATA_PREFIX + ":client-time[@" + IfmapStrings.PUBLISHER_ID_ATTR
			+ " = \"" + mSsrc.getPublisherId() + "\"]";
		PublishDelete pd = Requests.createPublishDelete(mDev, filter);
		pd.addNamespaceDeclaration(IfmapStrings.OP_METADATA_PREFIX,
				IfmapStrings.OP_METADATA_NS_URI);
		PublishRequest pr = Requests.createPublishReq(pd);

		mSsrc.publish(pr);
	}
638209
public void cleanup() {
		long currentTime = System.currentTimeMillis();

		// remove entries which have exceeded their time to live
		cachedExecutionGraphs.values().removeIf(
			(ExecutionGraphEntry entry) -> currentTime >= entry.getTTL());
	}
24386
def delete_expired_requests():
    """"""
    InclusionRequest.query.filter_by(
        InclusionRequest.expiry_date > datetime.utcnow()).delete()
    db.session.commit()