org.hibernate.cache.ehcache.internal.regions
Class EhcacheDataRegion

java.lang.Object
  extended by org.hibernate.cache.ehcache.internal.regions.EhcacheDataRegion
All Implemented Interfaces:
Region
Direct Known Subclasses:
EhcacheQueryResultsRegion, EhcacheTimestampsRegion, EhcacheTransactionalDataRegion

public abstract class EhcacheDataRegion
extends Object
implements Region

An Ehcache specific data region implementation.

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


Field Summary
protected  EhcacheAccessStrategyFactory accessStrategyFactory
          The EhcacheAccessStrategyFactory used for creating various access strategies
protected  net.sf.ehcache.Ehcache cache
          Ehcache instance backing this Hibernate data region.
 
Method Summary
 boolean contains(Object key)
          Returns true if this region contains data for the given key.
 void destroy()
          The "end state" contract of the region's lifecycle.
 net.sf.ehcache.Ehcache getEhcache()
          Return the Ehcache instance backing this Hibernate data region.
 long getElementCountInMemory()
          The count of entries currently contained in the regions in-memory store.
 long getElementCountOnDisk()
          The count of entries currently contained in the regions disk store.
 String getName()
          Retrieve the name of this region.
 long getSizeInMemory()
          The number of bytes is this cache region currently consuming in memory.
 int getTimeout()
          
 long nextTimestamp()
          
 Map toMap()
          Get the contents of this region as a map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected final net.sf.ehcache.Ehcache cache
Ehcache instance backing this Hibernate data region.


accessStrategyFactory

protected final EhcacheAccessStrategyFactory accessStrategyFactory
The EhcacheAccessStrategyFactory used for creating various access strategies

Method Detail

getName

public String getName()
Retrieve the name of this region.

Specified by:
getName in interface Region
Returns:
The region name

destroy

public void destroy()
             throws CacheException
The "end state" contract of the region's lifecycle. Called during SessionFactory.close() to give the region a chance to cleanup.

Specified by:
destroy in interface Region
Throws:
CacheException - Indicates problem shutting down

getSizeInMemory

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

Specified by:
getSizeInMemory in interface Region
Returns:
The number of bytes consumed by this region; -1 if unknown or unsupported.

getElementCountInMemory

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

Specified by:
getElementCountInMemory in interface Region
Returns:
The count of entries in memory; -1 if unknown or unsupported.

getElementCountOnDisk

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

Specified by:
getElementCountOnDisk in interface Region
Returns:
The count of entries on disk; -1 if unknown or unsupported.

toMap

public Map toMap()
Get the contents of this region as a map.

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

Specified by:
toMap in interface Region
Returns:
The content map.

nextTimestamp

public long nextTimestamp()

Specified by:
nextTimestamp in interface Region

getTimeout

public int getTimeout()

Specified by:
getTimeout in interface Region

getEhcache

public net.sf.ehcache.Ehcache getEhcache()
Return the Ehcache instance backing this Hibernate data region.


contains

public boolean contains(Object key)
Returns true if this region contains data for the given key.

This is a Hibernate 3.5 method.

Specified by:
contains in interface Region
Parameters:
key - The cache key
Returns:
True if the underlying cache contains corresponding data; false otherwise.


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.