CacheFactory Class

ScaleOut Software NamedCache API
Provides access to a collection of cached objects that is identified by a provided cache name. The GetCache(String) method must be used to instantiate a NamedCache collection.
Inheritance Hierarchy


Namespace:  Soss.Client
Assembly:  soss_namedcache (in soss_namedcache.dll) Version:

public static class CacheFactory

The CacheFactory type exposes the following members.


Public methodStatic memberGetCache
Create a cache using the default application id.
Public methodStatic memberGetCache(String)
Creates a NamedCache instance, associating the collection with the provided string identifier.
Public methodStatic memberGetCache(UInt32)
Creates a NamedCache instance, associating the collection with the provided application ID.
Public methodStatic memberGetCache(StateServerKey)
Creates a named cache using the application id extracted from a StateServerKey instance.

Public eventStatic memberNamedCacheCreated
An event that fires when a new NamedCache is created by the CacheFactory before its first use. You may hook this event to initialize NamedCache settings before the cache's first use.

For any given cache name, the CacheFactory maintains a single NamedCache instance. That instance is returned for any requests for a NamedCache of the given name. In particular, properties specified on a NamedCache instance immediately affect all users of the given NamedCache.

using System;
using Soss.Client;

class Program
    static void Main(string[] args)
        // Use the cache factory to access a named cache in the StateServer object store:
        NamedCache cache = CacheFactory.GetCache("namedCache");

        // Add an object to the cache:
        cache.Add("key", "This is an object in the named cache.");

        // Read and lock the object in the server:
        cache.Retrieve("key", true);

        // Update and unlock:
        cache.Update("key", "This is an update to the object", true);

        // Remove from the cache:
See Also