Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.hibernate.util
Class SimpleMRUCache  view SimpleMRUCache download SimpleMRUCache.java

java.lang.Object
  extended byorg.hibernate.util.SimpleMRUCache
All Implemented Interfaces:
java.io.Serializable

public class SimpleMRUCache
extends java.lang.Object
implements java.io.Serializable

Cache following a "Most Recently Used" (MRU) 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 bounded MRU Map to limit the in-memory size of the cache. Thus the size of this cache never grows beyond the stated size.


Field Summary
private  org.apache.commons.collections.LRUMap cache
           
static int DEFAULT_STRONG_REF_COUNT
           
private  int strongReferenceCount
           
 
Constructor Summary
SimpleMRUCache()
           
SimpleMRUCache(int strongReferenceCount)
           
 
Method Summary
 void clear()
           
 java.lang.Object get(java.lang.Object key)
           
private  void init()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
private  void readObject(java.io.ObjectInputStream in)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_STRONG_REF_COUNT

public static final int DEFAULT_STRONG_REF_COUNT
See Also:
Constant Field Values

strongReferenceCount

private final int strongReferenceCount

cache

private transient org.apache.commons.collections.LRUMap cache
Constructor Detail

SimpleMRUCache

public SimpleMRUCache()

SimpleMRUCache

public SimpleMRUCache(int strongReferenceCount)
Method Detail

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()

init

private void init()

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException

clear

public void clear()