public interface ExpiryStrategy
An expiry strategy is a strategy to evict cache entries due to the need to free up space. It will get an Iterator to the cache entries and the information if the iterator will iterate the elements in an LRU order or not. There might be different strategies for the cache.
Modifier and Type | Interface and Description |
---|---|
static class |
ExpiryStrategy.ExpiryPressure
Defines the importance of expiry.
|
Modifier and Type | Method and Description |
---|---|
void |
performExpiry(CacheIteratorFactory iteratorFactory,
TrackableCache cache,
boolean hasLRUOrdering,
ExpiryStrategy.ExpiryPressure expiryPressure)
Initiates an expiry call to the cache and returns how many objects have been expired.
|
void performExpiry(CacheIteratorFactory iteratorFactory, TrackableCache cache, boolean hasLRUOrdering, ExpiryStrategy.ExpiryPressure expiryPressure)
ExpiryStrategy.ExpiryPressure
indicating how urgent it is.
The expiry of cache entries shall be triggered by calling Iterator.remove()
on the Iterator
provided by CacheIteratorFactory.create()
. Iterator
s created using that method, will allow cache
modifications during iteration.
Attention: This is not thread safe! Locking has to happen in the cache's implementation!
iteratorFactory
- A CacheIteratorFactory
that creates an Iterator
to the caches
entries. The Iterator
created using the CacheIteratorFactory
shall be used
to removed entries from the cache.cache
- the TrackableCache
the ExpiryStrategy
is assigned tohasLRUOrdering
- If this is true, the collection has an LRU ordering, implying that it
will iterate from the oldest to the newest entry.expiryPressure
- Indicates if the expiry call is urgent or not.Copyright © 2024 levigo holding gmbh. All rights reserved.