Home | History | Annotate | Download | only in util

Lines Matching defs:Cache

28  * has an optional expiration time for cache items. The Map is thread-safe.<p>
30 * The algorithm for cache is as follows: a HashMap is maintained for fast
32 * order they are accessed from cache, the other keeps objects in the order
33 * they were originally added to cache. When objects are added to cache, they
40 * of the object in cache. Keeping a reference to the node lets us avoid
43 * To get an object from cache, a hash lookup is performed to get a reference
46 * and any necessary cache cleanups are performed. Cache deletion and expiration
51 public class Cache<K, V> implements Map<K, V> {
59 * Linked list to maintain order that cache objects are accessed
65 * Linked list to maintain time that cache objects were initially added
66 * to the cache, most recently added to oldest added.
71 * Maximum number of items the cache will hold.
76 * Maximum length of time objects can exist in cache before expiring.
81 * Maintain the number of cache hits and misses. A cache hit occurs every
82 * time the get method is called and the cache contains the requested
83 * object. A cache miss represents the opposite occurence.<p>
85 * Keeping track of cache hits and misses lets one measure how efficient
86 * the cache is; the higher the percentage of hits, the more efficient.
91 * Create a new cache and specify the maximum size of for the cache in
94 * @param maxSize the maximum number of objects the cache will hold. -1
95 * means the cache has no max size.
97 * cache before being deleted. -1 means objects never expire.
99 public Cache(int maxSize, long maxLifetime) {
101 throw new IllegalArgumentException("Max cache size cannot be 0.");
123 // Make an entry into the cache order list.
124 // Store the cache order list entry so that we can get back to it
132 // If cache is too full, remove least used cache entries until it is not too full.
139 // First, clear all entries that have been in cache longer than the
145 // The object didn't exist in cache, so increment cache misses.
149 // Remove the object from it's current place in the cache order list,
154 // The object exists in cache, so increment cache hits. Also, increment
168 * caused by cache internal processing such as eviction or loading
173 // If the object is not in cache, stop trying to remove it.
177 // Remove from the cache order list
203 // First, clear all entries that have been in cache longer than the
211 // First, clear all entries that have been in cache longer than the
219 // First, clear all entries that have been in cache longer than the
250 // First, clear all entries that have been in cache longer than the
272 // First, clear all entries that have been in cache longer than the
284 // in the same form they were put into cache.
286 // First, clear all entries that have been in cache longer than the
324 // First, clear all entries that have been in cache longer than the
345 // It's possible that the new max size is smaller than our current cache
359 * Clears all entries out of cache where the entries are older than the
379 // should expire from cache. Then, we can do an easy check to see
386 ") - cacheObject not found in cache!");
401 * Removes the least recently used elements if the cache size is greater than
402 * or equal to the maximum allowed size until the cache is at least 10% empty.
405 // Check if a max cache size is defined.
410 // See if the cache is too big. If so, clean out cache until it's 10% free.
414 // Next, delete the least recently used elements until 10% of the cache
422 "cacheObject not found in cache!");
430 * Wrapper for all objects put into cache. It's primary purpose is to maintain
444 * A reference to the node in the cache order list. We keep the reference
459 * A count of the number of times the object has been read from cache.
464 * Creates a new cache object wrapper.
622 * cache system. While it can be used as a general purpose linked list, for
633 * This class is further customized for the Jive cache system. It
635 * cache. Timestamps are stored as long values and represent the number
638 * The creation timestamp is used in the case that the cache has a
641 * deleted from cache.