GigaSpaces XAP 7.0 API

org.openspaces.hibernate.cache
Class SimpleMapCache

java.lang.Object
  extended by org.openspaces.hibernate.cache.SimpleMapCache
All Implemented Interfaces:
org.hibernate.cache.Cache
Direct Known Subclasses:
SimpleGigaMapCache

public class SimpleMapCache
extends Object
implements org.hibernate.cache.Cache

Simple map cache implements Hibenrate second level cache non-transactionally. Supports concurrency strategies of read-only, read-write.

Author:
kimchy

Constructor Summary
SimpleMapCache(String regionName, IMap map, long timeToLive, long waitForResponse)
           
 
Method Summary
 void clear()
          Clear the cache
 void destroy()
          Clean up
 Object get(Object key)
          Get an item from the cache, nontransactionally
 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 getRegionName()
          Get the name of the cache region
 long getSizeInMemory()
          The number of bytes is this cache region currently consuming in memory.
 int getTimeout()
          Get a reasonable "lock timeout"
 void lock(Object key)
          If this is a clustered cache, lock the item
 long nextTimestamp()
          Generate a timestamp
 void put(Object key, Object value)
          Add an item to the cache, nontransactionally, with failfast semantics
 Object read(Object key)
          Get an item from the cache
 void remove(Object key)
          Remove an item from the cache
 Map toMap()
          optional operation
 void unlock(Object key)
          If this is a clustered cache, unlock the item
 void update(Object key, Object value)
          Add an item to the cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMapCache

public SimpleMapCache(String regionName,
                      IMap map,
                      long timeToLive,
                      long waitForResponse)
Method Detail

read

public Object read(Object key)
            throws org.hibernate.cache.CacheException
Get an item from the cache

Specified by:
read in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

get

public Object get(Object key)
           throws org.hibernate.cache.CacheException
Get an item from the cache, nontransactionally

Specified by:
get in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

put

public void put(Object key,
                Object value)
         throws org.hibernate.cache.CacheException
Add an item to the cache, nontransactionally, with failfast semantics

Specified by:
put in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

update

public void update(Object key,
                   Object value)
            throws org.hibernate.cache.CacheException
Add an item to the cache

Specified by:
update in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

remove

public void remove(Object key)
            throws org.hibernate.cache.CacheException
Remove an item from the cache

Specified by:
remove in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

clear

public void clear()
           throws org.hibernate.cache.CacheException
Clear the cache

Specified by:
clear in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

destroy

public void destroy()
             throws org.hibernate.cache.CacheException
Clean up

Specified by:
destroy in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

lock

public void lock(Object key)
          throws org.hibernate.cache.CacheException
If this is a clustered cache, lock the item

Specified by:
lock in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

unlock

public void unlock(Object key)
            throws org.hibernate.cache.CacheException
If this is a clustered cache, unlock the item

Specified by:
unlock in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

nextTimestamp

public long nextTimestamp()
Generate a timestamp

Specified by:
nextTimestamp in interface org.hibernate.cache.Cache

getTimeout

public int getTimeout()
Get a reasonable "lock timeout"

Specified by:
getTimeout in interface org.hibernate.cache.Cache

getRegionName

public String getRegionName()
Get the name of the cache region

Specified by:
getRegionName in interface org.hibernate.cache.Cache

getSizeInMemory

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

Specified by:
getSizeInMemory in interface org.hibernate.cache.Cache
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 org.hibernate.cache.Cache
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 org.hibernate.cache.Cache
Returns:
The count of entries on disk; -1 if unknown or unsupported.

toMap

public Map toMap()
optional operation

Specified by:
toMap in interface org.hibernate.cache.Cache

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.