Class OverflowingLRUCache<K,V>

java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.util.LRUCache<K,V>
org.aspectj.org.eclipse.jdt.internal.core.OverflowingLRUCache<K,V>
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
BufferCache, ElementCache

public abstract class OverflowingLRUCache<K,V> extends LRUCache<K,V>
The OverflowingLRUCache is an LRUCache which attempts to maintain a size equal or less than its fSpaceLimit by removing the least recently used elements.

The cache will remove elements which successfully close and all elements which are explicitly removed.

If the cache cannot remove enough old elements to add new elements it will grow beyond fSpaceLimit. Later, it will attempt to shrink back to the maximum space limit. The method close should attempt to close the element. If the element is successfully closed it will return true and the element will be removed from the cache. Otherwise the element will remain in the cache.

The cache implicitly attempts shrinks on calls to putand setSpaceLimit. Explicitly calling the shrink method will also cause the cache to attempt to shrink.

The cache calculates the used space of all elements which implement ILRUCacheable. All other elements are assumed to be of size one.

Use the #peek(Object) and #disableTimestamps() method to circumvent the timestamp feature of the cache. This feature is intended to be used only when the #close(LRUCacheEntry) method causes changes to the cache. For example, if a parent closes its children when #close(LRUCacheEntry) is called, it should be careful not to change the LRU linked list. It can be sure it is not causing problems by calling #peek(Object) instead of #get(Object) method.

See Also: