Top Description Methods
org.hibernate.cache

public Interface Cache

Known Direct Subinterfaces
org.hibernate.cache.OptimisticCache
Known Direct Implementers
org.hibernate.cache.HashtableCache
Imports
java.util.Map

Deprecated

As of 3.3; see for details.

Implementors define a caching algorithm. All implementors must be threadsafe.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Clear the cache

public void
destroy()

Clean up

public Object

Returns:

the cached object or null
get
(Object key)

Get an item from the cache, nontransactionally

public long

Returns:

The count of entries in memory; -1 if unknown or unsupported.
getElementCountInMemory
()

The count of entries currently contained in the regions in-memory store.

public long

Returns:

The count of entries on disk; -1 if unknown or unsupported.
getElementCountOnDisk
()

The count of entries currently contained in the regions disk store.

public String
getRegionName()

Get the name of the cache region

public long

Returns:

The number of bytes consumed by this region; -1 if unknown or unsupported.
getSizeInMemory
()

The number of bytes is this cache region currently consuming in memory.

public int
getTimeout()

Get a reasonable "lock timeout"

public void
lock(Object key)

If this is a clustered cache, lock the item

public long
nextTimestamp()

Generate a timestamp

public void
put(Object key, Object value)

Add an item to the cache, nontransactionally, with failfast semantics

public Object

Returns:

the cached object or null
read
(Object key)

Get an item from the cache

public void
remove(Object key)

Remove an item from the cache

public Map<K, V>
toMap()

optional operation

public void
unlock(Object key)

If this is a clustered cache, unlock the item

public void
update(Object key, Object value)

Add an item to the cache

Method Detail

clearback to summary
public void clear() throws CacheException

Clear the cache

destroyback to summary
public void destroy() throws CacheException

Clean up

getback to summary
public Object get(Object key) throws CacheException

Get an item from the cache, nontransactionally

Returns:Object

the cached object or null

getElementCountInMemoryback to summary
public long getElementCountInMemory()

The count of entries currently contained in the regions in-memory store.

Returns:long

The count of entries in memory; -1 if unknown or unsupported.

getElementCountOnDiskback to summary
public long getElementCountOnDisk()

The count of entries currently contained in the regions disk store.

Returns:long

The count of entries on disk; -1 if unknown or unsupported.

getRegionNameback to summary
public String getRegionName()

Get the name of the cache region

getSizeInMemoryback to summary
public long getSizeInMemory()

The number of bytes is this cache region currently consuming in memory.

Returns:long

The number of bytes consumed by this region; -1 if unknown or unsupported.

getTimeoutback to summary
public int getTimeout()

Get a reasonable "lock timeout"

lockback to summary
public void lock(Object key) throws CacheException

If this is a clustered cache, lock the item

nextTimestampback to summary
public long nextTimestamp()

Generate a timestamp

putback to summary
public void put(Object key, Object value) throws CacheException

Add an item to the cache, nontransactionally, with failfast semantics

readback to summary
public Object read(Object key) throws CacheException

Get an item from the cache

Returns:Object

the cached object or null

removeback to summary
public void remove(Object key) throws CacheException

Remove an item from the cache

toMapback to summary
public Map<K, V> toMap()

optional operation

unlockback to summary
public void unlock(Object key) throws CacheException

If this is a clustered cache, unlock the item

updateback to summary
public void update(Object key, Object value) throws CacheException

Add an item to the cache