Package com.j_spaces.javax.cache

The Write/Read through Interfaces and Space Cache Interfaces.

See:
          Description

Interface Summary
Cache A cache, being a mechanism for efficient temporary storage of objects for the purpose of improving the overall performance of an application system.
CacheBulk This interface provides bulk operations support when the space interact with external data source.
CacheBulk.BulkEntry Interface for an entry involved in a bulk operation.
CacheEntry Each CacheEntry should implements this interface.
CacheIterator<E> An iterator over a collection of candidates to be loaded into the space.
CacheIteratorFactory This interface creates an iterator of matching candidates to be used by the following operations: read, readMultiple, take or takeMultiple using null template , non null template and SQLQuery - where several objects can match a given template.
CacheLifeCycleManager The CacheLifeCycleManager provides ability to control the life cycle of the CacheLoader and CacheStore implementation.
CacheLifeCycleManager.LifeCycleProperty LifeCycleProperty holds the property indicators returned by the underlying driver upon return of CacheLifeCycleManager.init(String, String, String, Properties).
CacheListener The listener interface for receiving cache events.
CacheLoader The CacheLoader implementation is provided to ensure read-through behavior of the space.
CacheQuery This CacheQuery used as argument for the following methods: CacheIteratorFactory CacheLoader.loadAll() The CacheQuery encapsulated the read,readMultiple ,take,taleMultiple template.
CacheStore The CacheStore implementation is provided to ensure read-through and write-through behavior of the space.
EvictionStrategy EvictionStrategy decides which entry to evict when the cache reaches its limits.
IConverter The IConverter Interface provides conversion methods when using GigaSpaces Entry internal representation - The IGSEntry.
 

Class Summary
AbstractCacheLoader This class used to provide conversion methods between user original object and GigaSpaces internal Entry representation - the IGSEntry.
 

Exception Summary
CacheException Description: CacheException is a generic exception, which indicates a cache error has occurred.
 

Package com.j_spaces.javax.cache Description

The Write/Read through Interfaces and Space Cache Interfaces.
Write/Read Through achieved using CacheStore and CacheLoader interfaces.
These are called when space operations performed allowing the space to interact with external data sources.


Configuration
CacheLoader/Store is configured in space schema XML configuration file as a persistent adapter.

The space schema should include the following:

<space-config>
<persistent>
<enabled>true</enabled>
<!-- name of the storage adapter class to be used by the space -->
<StorageAdapterClass>com.j_spaces.sadapter.cache.CacheAdapter</StorageAdapterClass>
<!-- CacheLoader or CacheStore implementation class name that will be used by space -->
<CacheLoaderClass>com.j_spaces.examples.jdbccachestore.spaceapi.CacheLoaderImpl</CacheLoaderClass>
<DataBaseName>jdbc:hsqldb:testDB</DataBaseName>
<userName>sa</userName>
<password></password>
</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.j_spaces.examples.jdbccachestore.spaceapi.CacheLoaderImpl
space-config.persistent.DataBaseName=jdbc:hsqldb:hsql://localhost:9003
space-config.persistent.userName=sa
space-config.persistent.password=
space-config.engine.cache_policy=0

You must use space-config.engine.cache_policy=0 (LRU policy) to activate the CacheStore and CacheLoader implementation.

It is recommended to configure also the following to control the space memory usage and the eviction behavior:
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

When a clustered space using CacheStore/Loader you should start all nodes using the following property:
-Dcom.gs.cluster.cache-loader.external-data-source=true

When a clustered space using Central for all nodes you should start all nodes using the following property:
-Dcom.gs.cluster.cache-loader.central-data-source=true

When the clustered space using different Database instance for each space instance you should start each node using the following property:
-Dcom.gs.cluster.cache-loader.central-data-source=false