|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.gigaspaces.hibernate.HibernateCacheLoaderImpl com.gigaspaces.hibernate.HibernateCacheStoreImpl
public class HibernateCacheStoreImpl
The HibernateCacheStoreImpl used to delgate changes done within GigaSpaces into external database via Hibernate 3.0 ORM.
When a matching entry is not found in the space the HibernateCacheStoreImpl is called to load the data from the database.
When data is written/put/taken/removed/updated HibernateCacheStoreImpl is responsible to perform the relevant changes at the external database.
See the CacheLoader
, CacheIteratorFactory
, CacheStore
and CacheBulk
for full description of the methods mapping between the Map/Space API and the HibernateCacheStoreImpl methods.
Configuration To use the HibernateCacheStoreImpl the space schema XML configuration file should include the following.When using the<space-config> <persistent> <enabled>true</enabled> <StorageAdapterClass>com.j_spaces.sadapter.cache.CacheAdapter</StorageAdapterClass> <CacheLoaderClass>com.gigaspaces.hibernate.HibernateCacheStoreImpl</CacheLoaderClass> <StorageAdapterURL>/config/</StorageAdapterURL> </persistent> <engine> <cache_policy>0</cache_policy> </engine> </space-config>
You may also use the following space properties: space-config.persistent.enabled=true space-config.persistent.StorageAdapterClass=com.j_spaces.sadapter.cache.CacheAdapter space-config.persistent.CacheLoaderClass=com.gigaspaces.hibernate.HibernateCacheStoreImpl space-config.engine.cache_policy=0 space-config.persistent.StorageAdapterURL= hibernate.cfg.xml location
HibernateCacheLoaderImpl
or HibernateCacheStoreImpl
the space-config.persistent.StorageAdapterURL will be used to locate Hibernate hibernate.cfg.xml configuration mapping file.
You must use space-config.engine.cache_policy=0 (LRU policy) to activate the CacheStore and CacheLoader implementation.
space-config.engine.memory_usage.enabled=true space-config.engine.memory_usage.high_watermark_percentage=95 space-config.engine.memory_usage.write_only_block_percentage=85 space-config.engine.memory_usage.write_only_check_percentage=76 space-config.engine.memory_usage.low_watermark_percentage=75 space-config.engine.memory_usage.eviction_batch_size=500
Note that only one,CacheLoader
orCacheStore
, but not both, is allowed to be used sinceCacheStore
extendsCacheLoader
interface.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.j_spaces.javax.cache.CacheBulk |
---|
CacheBulk.BulkEntry |
Nested classes/interfaces inherited from interface com.j_spaces.javax.cache.CacheLifeCycleManager |
---|
CacheLifeCycleManager.LifeCycleProperty |
Field Summary |
---|
Fields inherited from interface com.j_spaces.javax.cache.CacheBulk |
---|
ERASE, STORE |
Constructor Summary | |
---|---|
HibernateCacheStoreImpl()
|
Method Summary | |
---|---|
void |
erase(Object key)
Remove the specified key from the underlying store if present. |
void |
eraseAll()
called when space is cleaned - this might clean all secondary data storage. |
void |
eraseAll(Collection keys)
Remove the specified keys from the underlying store if present |
void |
store(List<CacheBulk.BulkEntry> bulk)
This method is called in the following scenarios: 1. |
void |
store(Object key,
Object value)
Store the specified values under the specified keys in the store. |
void |
storeAll(Map map)
Store the specified values under the specified keys in the underlying store. |
Methods inherited from class com.gigaspaces.hibernate.HibernateCacheLoaderImpl |
---|
dropTable, init, iterator, load, loadAll, shutdown |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.j_spaces.javax.cache.CacheLoader |
---|
load, loadAll |
Constructor Detail |
---|
public HibernateCacheStoreImpl()
Method Detail |
---|
public void store(Object key, Object value)
store
in interface CacheStore
key
- key to store the value undervalue
- value to be storedpublic void storeAll(Map map)
storeAll
in interface CacheStore
map
- a Map of any number of keys and values to storepublic void erase(Object key)
erase
in interface CacheStore
key
- key whose mapping is being removed from the cachepublic void eraseAll(Collection keys)
eraseAll
in interface CacheStore
keys
- keys whose mappings are being removed from the cachepublic void eraseAll()
public void store(List<CacheBulk.BulkEntry> bulk)
1. Transaction commit
2. Asynchronize persistency mode This method can throw RuntimeException.
This exception will be delivered to the client application wrapped by
com.j_spaces.javax.cache.CacheException
store
in interface CacheBulk
bulk
- This bulkSet contains set of BulkEntry
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |