Package org.hibernate.cache
Interface Region
- All Known Subinterfaces:
CollectionRegion,EntityRegion,GeneralDataRegion,QueryResultsRegion,TimestampsRegion,TransactionalDataRegion
- All Known Implementing Classes:
BaseGeneralDataRegionAdapter,BaseRegionAdapter,BaseTransactionalDataRegionAdapter,CollectionRegionAdapter,EntityRegionAdapter,QueryResultsRegionAdapter,TimestampsRegionAdapter
public interface Region
Defines a contract for accessing a particular named region within the
underlying cache implementation.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine whether this region contains data for the given key.voiddestroy()The "end state" contract of the region's lifecycle.longThe count of entries currently contained in the regions in-memory store.longThe count of entries currently contained in the regions disk store.getName()Retrieve the name of this region.longThe number of bytes is this cache region currently consuming in memory.intlongtoMap()Get the contents of this region as a map.
-
Method Details
-
getName
String getName()Retrieve the name of this region.- Returns:
- The region name
-
destroy
The "end state" contract of the region's lifecycle. Called duringSessionFactory.close()to give the region a chance to cleanup.- Throws:
CacheException- Indicates problem shutting down
-
contains
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()
-