Configuring NamedCache

ScaleOut Software NamedCache API

The NamedCache client library can use settings in a configuration file to set policies on objects stored in a Soss.ClientNamedCache. The NamedCache policy settings specified in a config file can be overridden on an object-by-object basis at runtime using the CreatePolicy class.

Custom config file section

To configure a cache's policy in an application configuration file, a new 'soss.client' element must be added under <configSections>:

soss.client section
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <section name="soss.client" type="Soss.Client.Config.ScaleoutSection, soss_namedcache" />
    </configSections>
</configuration>

Cache policy attributes

Multiple caches can have their policies configured under the <soss.client> section:

NamedCache configuration example
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <section name="soss.client"
                 type="Soss.Client.Config.ScaleoutSection, soss_namedcache" />
    </configSections>
    <soss.client>
        <cacheConfigs>
            <add
              cacheConfigName="CacheExample1"
              timeout="01:00:00"
              timeoutType ="Absolute"
              preemptionPriority="Normal"
              allowReplication="true"
              allowRemoteAccess="true"
              geoServerCoherencyPolicy="Notify"
              geoServerCoherencyInterval="00:01:00"
              remoteStores="MyRemoteStore"
              backingStoreMode="WriteBehind"
              backingStoreInterval="00:00:05"/>
            <add
              cacheConfigName="CacheExample2"
              timeout="00:45:00"
              timeoutType ="ResetOnUpdate"
              preemptionPriority="NotRemovable"
              allowReplication="false"
              allowRemoteAccess="false"
              geoServerCoherencyPolicy="NoAutoRefresh"
              geoServerCoherencyInterval="00:00:60"
              remoteStores=""
              backingStoreMode="None"
              backingStoreInterval="00:00:00"/>
        </cacheConfigs>        
    </soss.client>
</configuration>

The following parameters can be configured for each cache in a config file:

  • cacheConfigName - The name identifying the cache configuration (required). This name must match the name of the cache supplied to the GetCache method when your application creates the cache.

  • timeout - The lifetime of objects in this cache, with a minimum granularity of one second. Use 00:00:00 for an infinite timeout. The default is 00:00:00 (infinite).

    The timeout value is a string that is parsed using the same rules as TimeSpan.Parse.

    If the value is not infinite, the maximum allowed timeout is 48.13:05:03 (48 days, 13 hours, 5 minutes, 3 seconds).

    Timeouts for individual objects can override this setting when they are added to the cache using the Timeout property.

  • timeoutType - The conditions under which an object's timeout will be reset. The value must be one of the following:

    • "Absolute" - Default. An object's timeout is never reset.
    • "Sliding" - An object's timeout is reset every time an object is accessed (either updated or read).
    • "ResetOnUpdate" - An object's timeout is reset when the object is updated, but it is not reset if the object is read.

  • preemptionPriority - The preemption priority for objects in the cache, which specifies whether the least recently accessed objects may be evicted when the ScaleOut service runs low on memory. The value must be one of the following:

    • "Normal" - Default. Objects may be removed from the cache if needed by the ScaleOut service when running under low-memory conditions.
    • "NotRemovable" - Objects must remain in the ScaleOut service until its expiration is reached or the object is explicitly removed.

  • allowReplication - Specifies whether the cache participates in GeoServer replication. (GeoServer DR or Pro must be licensed and the ScaleOut service must be configured for GeoServer Push or Pull replication, otherwise this parameter is ignored).

  • allowRemoteAccess - Specifies whether the cache objects will be accessible to remote stores via GeoServer Pull replication. (GeoServer Pro must be licensed and the ScaleOut service must be configured for GeoServer Push or Pull replication, otherwise this parameter is ignored). The default value is true. Use the geoServerCoherencyPolicy property to specify how a local store interacts with objects in remote stores.

  • geoServerCoherencyPolicy - Sets the policy for how GeoServer remote stores should refresh their proxies to objects in the cache when GeoServer Pull replication is being used. (GeoServer Pro must be licensed and the ScaleOut service must be configured for GeoServer Pull replication, otherwise this parameter is ignored). The value must be one of the following:

    • "NoAutoRefresh" - Default. Proxy objects in other stores should not be refreshed automatically.
    • "Poll" - Proxy objects will be periodically refreshed in remote stores. Use the geoServerCoherencyInterval value to specify the frequency.
    • "Notify" - Remote stores will be notified of changes to the objects so they can refresh their proxy objects.

  • geoServerCoherencyInterval - Specifies how often GeoServer remote stores will refresh their proxies to objects in the cache if the Poll policy is used with GeoServer pull replication. The default value is 00:04:00 (four minutes).

  • remoteStores - A comma-separated list of GeoServer remote store names that this cache should use to look for objects that are not found in the local store. Read calls will check remote stores in the order that they are listed. If a missing object is found in one of the specified remote stores then it will be replicated to the local store using GeoServer Pro replication. The specified name(s) must exactly match the names of remote stores that are configured for GeoServer Pull replication. For a Pull replication with the Notify coherency policy only one remote store is supported.

  • backingStoreMode - Specifies the type of backing store event that should fire for objects in the cache. The value must be one of the following:

    • "None" - Default. Objects do not participate in backing store integration.
    • "WriteBehind" - A write-behind event should be periodically fired.
    • "RefreshAhead" - A refresh-ahead event should be periodically fired.

  • backingStoreInterval - The interval between backing store events (read-ahead, write-behind) for objects in the cache. The default value is 00:04:00 (four minutes).

    This value is a string that is parsed using the same rules as TimeSpan.Parse.

    The maximum allowed backing store interval is 48.13:05:03 (48 days, 13 hours, 5 minutes, 3 seconds).