segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/SegmentKeyCache.java
/**
     * Collects and unregisters all Cache Entries with a generation smaller than the given one. This method does not
     * actually execute the eviction since it is invoked while a lock is held in {@link ContainerKeyCache}. The caller
     * ({@link ContainerKeyCache}) needs to execute the actual cache eviction.
     *
     * @param oldestGeneration The oldest permissible generation.
     * @return A List of {@link CacheEntry} instances representing the evicted entries.
     */
Collects and unregisters all Cache Entries with a generation smaller than the given one. This method does not
actually execute the eviction since it is invoked while a lock is held in  ContainerKeyCache. The caller
( ContainerKeyCache) needs to execute the actual cache eviction.

@param oldestGeneration The oldest permissible generation.
@return A List of  CacheEntry instances representing the evicted entries.
Collects and unregisters all Cache Entries with a generation smaller than the given one . This method does not actually execute the eviction since it is invoked while a lock is held in ContainerKeyCache . The caller ( ContainerKeyCache ) needs to execute the actual cache eviction . @param oldestGeneration The oldest permissible generation . @return A List of CacheEntry instances representing the evicted entries .
synchronized List<CacheEntry> evictBefore(int oldestGeneration) {
        ArrayList<CacheEntry> removedEntries = new ArrayList<>();
        for (val e : this.cacheEntries.entrySet()) {
            CacheEntry entry = e.getValue();
            if (entry.getGeneration() < oldestGeneration
                    && entry.getHighestOffset() < this.lastIndexedOffset) {
                removedEntries.add(entry);
            }
        }
        removedEntries.forEach(e -> this.cacheEntries.remove(e.hashGroup));
        return removedEntries;
    }
synchronized List < CacheEntry > evictBefore ( int oldestGeneration ) { ArrayList < CacheEntry > removedEntries = new ArrayList < > ( ) ; for ( val e : this . cacheEntries . entrySet ( ) ) { CacheEntry entry = e . getValue ( ) ; if ( entry . getGeneration ( ) < oldestGeneration && entry . getHighestOffset ( ) < this . lastIndexedOffset ) { removedEntries . add ( entry ) ; } } removedEntries . forEach ( e -> this . cacheEntries . remove ( e . hashGroup ) ) ; return removedEntries ; }
Collects and unregisters all Cache Entries with a generation smaller than the given one.
Collects and unregisters all Cache Entries with a generation smaller than the given one .
// Remove those entries that have a generation below the oldest permissible one. // Clear the expired cache entries.