Class ExpiringSet<E>

Type Parameters:
E - the type of elements maintained by this set
All Implemented Interfaces:
Iterable<E>, Collection<E>, Set<E>

public class ExpiringSet<E> extends Object implements Set<E>
A Set that expires elements based on oldest age (when maximum size has been exceeded) or write

The expiration policy is only enforced on set access. There will be no automatic expiration handling running in a background thread or similar. For performance reasons the policy is not enforced on every single access, but only once every "expiration window" (Math.max(expireAfterWrite, expireAfterAccess)). Therefore, it may happen that elements are kept in the set up to the double expiration window length.

This data structure is not thread-safe!