Top Description Fields Constructors Methods
org.hibernate.cache

public Class HashtableCache

extends Object
implements Cache
Class Inheritance
All Implemented Interfaces
org.hibernate.cache.Cache
Imports
java.util.Collections, .Hashtable, .Map

Deprecated

as a consequence of Cache being deprecated. See corresponding docs for further information.

A lightweight implementation of the Cache interface
Author
Gavin King

Field Summary

Modifier and TypeField and Description
private final Map<K, V>
private final String

Constructor Summary

AccessConstructor and Description
public
HashtableCache(String regionName)

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements org.hibernate.cache.Cache.clear.

Clear the cache
public void
public Object
get(Object key)

Implements org.hibernate.cache.Cache.get.

Get an item from the cache, nontransactionally
public long
getElementCountInMemory()

Implements org.hibernate.cache.Cache.getElementCountInMemory.

The count of entries currently contained in the regions in-memory store.
public long
getElementCountOnDisk()

Implements org.hibernate.cache.Cache.getElementCountOnDisk.

The count of entries currently contained in the regions disk store.
public String
getRegionName()

Implements org.hibernate.cache.Cache.getRegionName.

Get the name of the cache region
public long
getSizeInMemory()

Implements org.hibernate.cache.Cache.getSizeInMemory.

The number of bytes is this cache region currently consuming in memory.
public int
getTimeout()

Implements org.hibernate.cache.Cache.getTimeout.

Get a reasonable "lock timeout"
public void
lock(Object key)

Implements org.hibernate.cache.Cache.lock.

If this is a clustered cache, lock the item
public long
nextTimestamp()

Implements org.hibernate.cache.Cache.nextTimestamp.

Generate a timestamp
public void
put(Object key, Object value)

Implements org.hibernate.cache.Cache.put.

Add an item to the cache, nontransactionally, with failfast semantics
public Object
read(Object key)

Implements org.hibernate.cache.Cache.read.

Get an item from the cache
public void
remove(Object key)

Implements org.hibernate.cache.Cache.remove.

Remove an item from the cache
public Map<K, V>
toMap()

Implements org.hibernate.cache.Cache.toMap.

optional operation
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
unlock(Object key)

Implements org.hibernate.cache.Cache.unlock.

If this is a clustered cache, unlock the item
public void
update(Object key, Object value)

Implements org.hibernate.cache.Cache.update.

Add an item to the cache
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

hashtableback to summary
private final Map<K, V> hashtable
regionNameback to summary
private final String regionName

Constructor Detail

HashtableCacheback to summary
public HashtableCache(String regionName)

Method Detail

clearback to summary
public void clear() throws CacheException

Implements org.hibernate.cache.Cache.clear.

Doc from org.hibernate.cache.Cache.clear.

Clear the cache

destroyback to summary
public void destroy() throws CacheException

Implements org.hibernate.cache.Cache.destroy.

Doc from org.hibernate.cache.Cache.destroy.

Clean up

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

Implements org.hibernate.cache.Cache.get.

Doc from org.hibernate.cache.Cache.get.

Get an item from the cache, nontransactionally

Returns:Object

the cached object or null

getElementCountInMemoryback to summary
public long getElementCountInMemory()

Implements org.hibernate.cache.Cache.getElementCountInMemory.

Doc from org.hibernate.cache.Cache.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()

Implements org.hibernate.cache.Cache.getElementCountOnDisk.

Doc from org.hibernate.cache.Cache.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()

Implements org.hibernate.cache.Cache.getRegionName.

Doc from org.hibernate.cache.Cache.getRegionName.

Get the name of the cache region

getSizeInMemoryback to summary
public long getSizeInMemory()

Implements org.hibernate.cache.Cache.getSizeInMemory.

Doc from org.hibernate.cache.Cache.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()

Implements org.hibernate.cache.Cache.getTimeout.

Doc from org.hibernate.cache.Cache.getTimeout.

Get a reasonable "lock timeout"

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

Implements org.hibernate.cache.Cache.lock.

Doc from org.hibernate.cache.Cache.lock.

If this is a clustered cache, lock the item

nextTimestampback to summary
public long nextTimestamp()

Implements org.hibernate.cache.Cache.nextTimestamp.

Doc from org.hibernate.cache.Cache.nextTimestamp.

Generate a timestamp

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

Implements org.hibernate.cache.Cache.put.

Doc from org.hibernate.cache.Cache.put.

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

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

Implements org.hibernate.cache.Cache.read.

Doc from org.hibernate.cache.Cache.read.

Get an item from the cache

Returns:Object

the cached object or null

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

Implements org.hibernate.cache.Cache.remove.

Doc from org.hibernate.cache.Cache.remove.

Remove an item from the cache

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

Implements org.hibernate.cache.Cache.toMap.

Doc from org.hibernate.cache.Cache.toMap.

optional operation

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

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

Implements org.hibernate.cache.Cache.unlock.

Doc from org.hibernate.cache.Cache.unlock.

If this is a clustered cache, unlock the item

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

Implements org.hibernate.cache.Cache.update.

Doc from org.hibernate.cache.Cache.update.

Add an item to the cache