org.hibernate.util

Class SimpleMRUCache

Implemented Interfaces:
Serializable

public class SimpleMRUCache
extends java.lang.Object
implements 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.

Author:
Steve Ebersole

Field Summary

static int
DEFAULT_STRONG_REF_COUNT

Constructor Summary

SimpleMRUCache()
SimpleMRUCache(int strongReferenceCount)

Method Summary

void
clear()
Object
get(Object key)
Object
put(Object key, Object value)
int
size()

Field Details

DEFAULT_STRONG_REF_COUNT

public static final int DEFAULT_STRONG_REF_COUNT
Field Value:
128

Constructor Details

SimpleMRUCache

public SimpleMRUCache()

SimpleMRUCache

public SimpleMRUCache(int strongReferenceCount)

Method Details

clear

public void clear()

get

public Object get(Object key)

put

public Object put(Object key,
                  Object value)

size

public int size()