org.hibernate.cache.spi
Interface Region

All Known Subinterfaces:
CollectionRegion, EntityRegion, GeneralDataRegion, NaturalIdRegion, QueryResultsRegion, TimestampsRegion, TransactionalDataRegion
All Known Implementing Classes:
BaseGeneralDataRegion, BaseRegion, BaseTransactionalDataRegion, ClusteredTimestampsRegionImpl, CollectionRegionImpl, EhcacheCollectionRegion, EhcacheDataRegion, EhcacheEntityRegion, EhcacheNaturalIdRegion, EhcacheQueryResultsRegion, EhcacheTimestampsRegion, EhcacheTransactionalDataRegion, EntityRegionImpl, NaturalIdRegionImpl, QueryResultsRegionImpl, TimestampsRegionImpl

public interface Region

Defines a contract for accessing a particular named region within the underlying cache implementation.


Method Summary
 boolean contains(Object key)
          Determine whether this region contains data for the given key.
 void destroy()
          The "end state" contract of the region's lifecycle.
 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.
 

Method Detail

getName

String getName()
Retrieve the name of this region.

Returns:
The region name

destroy

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.

Throws:
CacheException - Indicates problem shutting down

contains

boolean contains(Object key)
Determine whether this region contains data for the given key.

The semantic here is whether the cache contains data visible for the current call context. This should be viewed as a "best effort", meaning blocking should be avoid if possible.

Parameters:
key - The cache key
Returns:
True if the underlying cache contains corresponding data; false otherwise.

getSizeInMemory

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

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

getElementCountInMemory

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

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

getElementCountOnDisk

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

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

toMap

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

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

Returns:
The content map.

nextTimestamp

long nextTimestamp()

getTimeout

int getTimeout()


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