org.eclipse.core.internal.utils
Class Cache

java.lang.Object
  extended by org.eclipse.core.internal.utils.Cache

public class Cache
extends java.lang.Object

A cache that keeps a collection of at most maximumCapacity+threshold entries. When the number of entries exceeds that limit, least recently used entries are removed so the current size is the same as the maximum capacity.


Nested Class Summary
 class Cache.Entry
           
 
Constructor Summary
Cache(int maximumCapacity)
           
Cache(int initialCapacity, int maximumCapacity, double threshold)
           
 
Method Summary
 void addEntry(java.lang.Object key, java.lang.Object toCache)
           
 Cache.Entry addEntry(java.lang.Object key, java.lang.Object toCache, long timestamp)
           
 void discardAll()
           
 void dispose()
           
 Cache.Entry getEntry(java.lang.Object key)
           
 Cache.Entry getEntry(java.lang.Object key, boolean update)
           
 Cache.Entry getHead()
           
 Cache.Entry getTail()
           
 long size()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cache

public Cache(int maximumCapacity)

Cache

public Cache(int initialCapacity,
             int maximumCapacity,
             double threshold)
Method Detail

addEntry

public void addEntry(java.lang.Object key,
                     java.lang.Object toCache)

addEntry

public Cache.Entry addEntry(java.lang.Object key,
                            java.lang.Object toCache,
                            long timestamp)

getEntry

public Cache.Entry getEntry(java.lang.Object key)

getEntry

public Cache.Entry getEntry(java.lang.Object key,
                            boolean update)

getHead

public Cache.Entry getHead()

getTail

public Cache.Entry getTail()

size

public long size()

discardAll

public void discardAll()

dispose

public void dispose()