com.scaleoutsoftware.soss.client
Class BackingStorePolicy

java.lang.Object
  extended by com.scaleoutsoftware.soss.client.BackingStorePolicy

public final class BackingStorePolicy
extends Object

Contains options to control how a NamedCache interacts with a backing store. A BackingStorePolicy is associated with a NamedCache and BackingStore instance through a call to NamedCache.setBackingStoreAdapter().

The BackingStorePolicy controls read-through, write-through, refresh-ahead, and write-behind behavior when ScaleOut StateServer is being used as cache for a persistent backing store (such as a database). Use the enableAsyncOperations property to enable asynchronous refresh-ahead and write-behind operations.

If read-through operations are enabled, it is not desirable for every client process to simultaneously query the database when a cache miss occurs, so the enableReadThrough property will affect the behavior of the NamedCache.retrieve and NamedCache.get methods when a cache miss occurs.

The first client to perform a retrieval operation on an object that's missing from the cache will have its BackingStore.load implementation invoked. While the backing store is being queried, other clients requesting this object will repeatedly poll until the object has been inserted into the cache. The frequency of the polling behavior can be controlled by using NamedCache.setReadPendingRetryInterval and NamedCache.setMaxReadThroughPendingAttempts methods. The enableWriteThrough property is used to indicate to the StateServer that the client will be performing write-through operations via an implementation of BackingStore.store. Changing properties of the BackingStorePolicy after a call to NamedCache.setBackingStoreAdapter will not change the NamedCache's behavior - setBackingStoreAdapter must be called again for the new policy options to take effect.


Constructor Summary
BackingStorePolicy()
          Creates a BackingStorePolicy object with all options set to false.
BackingStorePolicy(boolean enableAsyncOperations, boolean enableReadThrough, boolean enableWriteThrough)
          Creates a BackingStorePolicy object.
 
Method Summary
 boolean getEnableAsyncOperations()
          If true, a client will handle asynchronous refresh-ahead/write-behind operations.
 boolean getEnableReadThrough()
          If true, a client will populate the StateServer automatically from a database (or other type of backing store) when a cache miss occurs by invoking the BackingStore.load method.
 boolean getEnableWriteThrough()
          If true, a client will synchronously write changes to a database (or other type of backing store) when a cached object is updated or created in the cache by invoking the BackingStore.store method.
 void setEnableAsyncOperations(boolean enableAsyncOperations)
          If true, a client will handle asynchronous refresh-ahead/write-behind operations.
 void setEnableReadThrough(boolean enableReadThrough)
          If true, a client will populate the StateServer automatically from a database (or other type of backing store) when a cache miss occurs by invoking the BackingStore.load method.
 void setEnableWriteThrough(boolean enableWriteThrough)
          If true, a client will synchronously write changes to a database (or other type of backing store) when a cached object is updated or created in the cache by invoking the BackingStore.store method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BackingStorePolicy

public BackingStorePolicy()
Creates a BackingStorePolicy object with all options set to false.


BackingStorePolicy

public BackingStorePolicy(boolean enableAsyncOperations,
                          boolean enableReadThrough,
                          boolean enableWriteThrough)
Creates a BackingStorePolicy object.

Parameters:
enableAsyncOperations - Indicates whether this client will handle asynchronous refresh-ahead/write-behind operations
enableReadThrough - If true, a client will populate the StateServer automatically from a database (or other type of backing store) when a cache miss occurs by invoking the BackingStore.load method
enableWriteThrough - If true, a client will synchronously write changes to a database (or other type of backing store) when a cached object is updated or created in the cache by invoking the BackingStore.store method
Method Detail

getEnableAsyncOperations

public boolean getEnableAsyncOperations()
If true, a client will handle asynchronous refresh-ahead/write-behind operations.

Returns:
enableAsyncOperations value

setEnableAsyncOperations

public void setEnableAsyncOperations(boolean enableAsyncOperations)
If true, a client will handle asynchronous refresh-ahead/write-behind operations.

Parameters:
enableAsyncOperations - new enableAsyncOperations value

getEnableReadThrough

public boolean getEnableReadThrough()
If true, a client will populate the StateServer automatically from a database (or other type of backing store) when a cache miss occurs by invoking the BackingStore.load method.

Returns:
enableReadThrough value

setEnableReadThrough

public void setEnableReadThrough(boolean enableReadThrough)
If true, a client will populate the StateServer automatically from a database (or other type of backing store) when a cache miss occurs by invoking the BackingStore.load method.

Parameters:
enableReadThrough - new enableReadThrough value

getEnableWriteThrough

public boolean getEnableWriteThrough()
If true, a client will synchronously write changes to a database (or other type of backing store) when a cached object is updated or created in the cache by invoking the BackingStore.store method.

Returns:
enableWriteThrough value

setEnableWriteThrough

public void setEnableWriteThrough(boolean enableWriteThrough)
If true, a client will synchronously write changes to a database (or other type of backing store) when a cached object is updated or created in the cache by invoking the BackingStore.store method.

Parameters:
enableWriteThrough - new enableWriteThrough value


Copyright (C) 2007-2012 ScaleOut Software, Inc.