org.hibernate.util
Class SoftLimitMRUCache
java.lang.Object
org.hibernate.util.SoftLimitMRUCache
- All Implemented Interfaces:
- java.io.Serializable
public class SoftLimitMRUCache
- extends java.lang.Object
- implements java.io.Serializable
Cache following a "Most Recently Used" (MRY) algorithm for maintaining a
bounded in-memory size; the "Least Recently Used" (LRU) entry is the first
available for removal from the cache.
This implementation uses a "soft limit" to the in-memory size of the cache,
meaning that all cache entries are kept within a completely
SoftReference
-based map with the most recently utilized
entries additionally kept in a hard-reference manner to prevent those cache
entries soft references from becoming enqueued by the garbage collector.
Thus the actual size of this cache impl can actually grow beyond the stated
max size bound as long as GC is not actively seeking soft references for
enqueuement.
- Author:
- Steve Ebersole
- See Also:
- Serialized Form
Method Summary |
void |
clear()
|
java.lang.Object |
get(java.lang.Object key)
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
int |
size()
|
int |
softSize()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_STRONG_REF_COUNT
public static final int DEFAULT_STRONG_REF_COUNT
- See Also:
- Constant Field Values
SoftLimitMRUCache
public SoftLimitMRUCache()
SoftLimitMRUCache
public SoftLimitMRUCache(int strongRefCount)
get
public java.lang.Object get(java.lang.Object key)
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
size
public int size()
softSize
public int softSize()
clear
public void clear()
Copyright © 2008 Hibernate.org. All Rights Reserved.