Read-Through and Write-Through Settings and Configuration

  GigaSpaces 5.X

Documentation Home
Quick Start Guide
Release Notes

Previous release

  Search Here
Searching GigaSpaces Platform 5.X Documentation

                                               

Summary: The CacheLifeCycleManager provides ability to control the life cycle of the CacheLoader and CacheStore implementation.

This page is specific to:
GigaSpaces 5.x

If you're interested in another version, click it below:
GigaSpaces 6.0
GigaSpaces 6.5

Configuring the CacheLoader - CacheLifeCycleManager

The CacheLifeCycleManager provides ability to control the lifecycle of the CacheLoader and CacheStore implementation. The CacheLoader is configured in space schema XML configuration file as a persistent adapter.
The CacheLifeCycleManager.init method configures the CacheLoader as well as the space.
The CacheLifeCycleManager configures cases where the space needs to interact with the underlying data source once it is started or when it is shut down.
The configuration information is returned by the init method as CacheLifeCycleManager.LifeCycleProperty, which contains the property indicators returned by the underlying driver.

The Entity-Class Setting

when using the Map API users should define the table name (called also Entity) to use when reading value object data.

Central Data Source

Recovery should be set to false in cluster-xml when working with central-data-source since the Entries are already in the database and there is no need to recover them from a backup space.

Central Data Source with Partitioned Space

When running in partition space cluster topology each partition may use the same database server instance to store its data.
The relevant setting used to control this option is set <central-data-source>${com.gs.cluster.cache-loader.central-data-source}</central-data-source> in cluster-xml.

Class Mapping

CacheLifeCycleManager.init should introduce to the space the Directory which holds the domain classes gs.xml.

Inheritance (Sub-Classes) Support

If the underlying data source supports sub-class query, like Hibernate, the CacheLoader will invoke a call to loadAll/load only once for the queried super class. Otherwise CacheLoader.loadAll/load will be called for the super class and each of its sub-classes.
The relevant setting indicating this behavior SUPPORTS_INHERITANCE is returned in CacheLifeCycleManager.LifeCycleProperty.

Cache Preload and Refresh Ahead

The user can load data into the space when started or pre-fetch "extra" to speed up future queries.
To do this, load some amount after the CacheLifeCycleManager.init is called. Call either loadAll or iterator with java.lang.Object.

The Space Mapping Configuration File gs.xml

You can define space class meta data using class and field level decorations. These can be defined via Annotations and XML space class mapping configuration files.

For more details, refer to the POJO Class and Field Level Annotations section.

Space Classpath

The space classpath includes user classes and gs.xml files that are loaded as resources. The following table shows when these are used and where they should be located.

Classes/Files When Used Location
gs.xml On application and space startup. <ROOT FOLDER>\config\mapping
hibernate.cfg.xml Hibernate Driver initialization classpath, or configured as part of the <persistent><StorageAdapterURL> tag in the space schema.

Troubleshooting

To enable logging for CacheLoader\Store, edit the <GigaSpaces Root>\config\gs_logging.properties file and set the persistent level to CONFIG or FINER.

  • CONFIG messages are intended to provide a variety of static configuration information, and to assist in debugging problems that may be associated with particular configurations.
com.gigaspaces.persistent.level = CONFIG

for example:

+_CONFIG: 
schema-xml configuration:
<persistent>
     <CacheLoaderClass>com.gigaspaces.hibernate.HibernateCacheStoreImpl</CacheLoaderClass>
     <StorageAdapterClass>com.j_spaces.sadapter.cache.CacheAdapter</StorageAdapterClass>
     <entity-class>com.gigaspaces.test.cacheloader.PersonPojo</entity-class>
</persistent>
cluster-xml configuration:
<cache-loader>
     <external-data-source>false</external-data-source>
     <central-data-source>false</central-data-source>
</cache-loader>
_
  • FINER messages log calls for entering, returning, or throwing an exception
    to and from cache interface implementations.
com.gigaspaces.persistent.level = FINER

For example:

_Jul 3, 2006 4:13:16 PM com.j_spaces.sadapter.cache.CacheStorage CacheLoader#load
FINER: ENTRY IGSEntry<com.gigaspaces.test.cacheloader.PersonEntry>
Jul 3, 2006 4:13:16 PM com.j_spaces.sadapter.cache.CacheStorage CacheLoader#load
FINER: RETURN null_
For details on viewing the exact configuration in which the system is currently running, refer to the Container Maintenance section.

Wiki Content Tree


Your Feedback Needed!

We need your help to improve this wiki site. If you have any suggestions or corrections, write to us at techw@gigaspaces.com. Please provide a link to the wiki page you are referring to.

Labels

 
(None)