Top Description Fields Constructors Methods
net.sf.ehcache.hibernate.regions

public abstract Class EhcacheDataRegion

extends Object
implements Region
Class Inheritance
All Implemented Interfaces
org.hibernate.cache.Region
Known Direct Subclasses
net.sf.ehcache.hibernate.regions.EhcacheGeneralDataRegion, net.sf.ehcache.hibernate.regions.EhcacheTransactionalDataRegion
Imports
java.util.Collections, .HashMap, .Map, .Properties, net.sf.ehcache.Ehcache, .Element, net.sf.ehcache.constructs.nonstop.NonStopCacheException, net.sf.ehcache.hibernate.nonstop.HibernateNonstopCacheExceptionHandler, net.sf.ehcache.hibernate.strategy.EhcacheAccessStrategyFactory, net.sf.ehcache.util.Timestamper, org.hibernate.cache.CacheException, .Region, org.slf4j.Logger, .LoggerFactory

An Ehcache specific data region implementation.

This class is the ultimate superclass for all Ehcache Hibernate cache regions.

Authors
Chris Dennis, Greg Luck, Emmanuel Bernard, Abhishek Sanoujam

Field Summary

Modifier and TypeField and Description
protected final EhcacheAccessStrategyFactory
accessStrategyFactory

The EhcacheAccessStrategyFactory used for creating various access strategies

protected final Ehcache
cache

Ehcache instance backing this Hibernate data region.

private static final String
private final int
private static final int
private static final Logger

Constructor Summary

AccessConstructor and Description
pack-priv
EhcacheDataRegion(EhcacheAccessStrategyFactory accessStrategyFactory, Ehcache cache, Properties properties)

Create a Hibernate data region backed by the given Ehcache instance.

Method Summary

Modifier and TypeMethod and Description
public boolean
contains(Object
The cache key
key
)

Implements org.hibernate.cache.Region.contains.

Returns true if this region contains data for the given key.
public void
destroy()

Implements org.hibernate.cache.Region.destroy.

The "end state" contract of the region's lifecycle.
public Ehcache
getEhcache()

Return the Ehcache instance backing this Hibernate data region.

public long
getElementCountInMemory()

Implements org.hibernate.cache.Region.getElementCountInMemory.

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

Implements org.hibernate.cache.Region.getElementCountOnDisk.

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

Implements org.hibernate.cache.Region.getName.

Retrieve the name of this region.
public long
getSizeInMemory()

Implements org.hibernate.cache.Region.getSizeInMemory.

The number of bytes is this cache region currently consuming in memory.
public int
public long
public Map<K, V>
toMap()

Implements org.hibernate.cache.Region.toMap.

Get the contents of this region as a map.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

accessStrategyFactoryback to summary
protected final EhcacheAccessStrategyFactory accessStrategyFactory

The EhcacheAccessStrategyFactory used for creating various access strategies

cacheback to summary
protected final Ehcache cache

Ehcache instance backing this Hibernate data region.

CACHE_LOCK_TIMEOUT_PROPERTYback to summary
private static final String CACHE_LOCK_TIMEOUT_PROPERTY
cacheLockTimeoutback to summary
private final int cacheLockTimeout
DEFAULT_CACHE_LOCK_TIMEOUTback to summary
private static final int DEFAULT_CACHE_LOCK_TIMEOUT
LOGback to summary
private static final Logger LOG

Constructor Detail

EhcacheDataRegionback to summary
pack-priv EhcacheDataRegion(EhcacheAccessStrategyFactory accessStrategyFactory, Ehcache cache, Properties properties)

Create a Hibernate data region backed by the given Ehcache instance.

Method Detail

containsback to summary
public boolean contains(Object key)

Implements org.hibernate.cache.Region.contains.

Returns true if this region contains data for the given key.

This is a Hibernate 3.5 method.

Parameters
key:Object

Doc from org.hibernate.cache.Region.contains.

The cache key

Returns:boolean

Doc from org.hibernate.cache.Region.contains.

True if the underlying cache contains corresponding data; false otherwise.

destroyback to summary
public void destroy() throws CacheException

Implements org.hibernate.cache.Region.destroy.

Doc from org.hibernate.cache.Region.destroy.

The "end state" contract of the region's lifecycle. Called during org.hibernate.SessionFactory#close() to give the region a chance to cleanup.

Exceptions
CacheException:
Indicates problem shutting down
getEhcacheback to summary
public Ehcache getEhcache()

Return the Ehcache instance backing this Hibernate data region.

getElementCountInMemoryback to summary
public long getElementCountInMemory()

Implements org.hibernate.cache.Region.getElementCountInMemory.

Doc from org.hibernate.cache.Region.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.Region.getElementCountOnDisk.

Doc from org.hibernate.cache.Region.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.

getNameback to summary
public String getName()

Implements org.hibernate.cache.Region.getName.

Doc from org.hibernate.cache.Region.getName.

Retrieve the name of this region.

Returns:String

The region name

getSizeInMemoryback to summary
public long getSizeInMemory()

Implements org.hibernate.cache.Region.getSizeInMemory.

Doc from org.hibernate.cache.Region.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.Region.getTimeout.

nextTimestampback to summary
public long nextTimestamp()

Implements org.hibernate.cache.Region.nextTimestamp.

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

Implements org.hibernate.cache.Region.toMap.

Doc from org.hibernate.cache.Region.toMap.

Get the contents of this region as a map.

Implementors which do not support this notion should simply return an empty map.

Returns:Map<K, V>

The content map.