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

SystemObject
  Soss.ClientCacheFactory

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

public static class CacheFactory

The CacheFactory type exposes the following members.

Methods

  NameDescription
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.
Top
Events

  NameDescription
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.
Top
Remarks

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.
Examples

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:
        cache.Remove("key");
    }
}
See Also

Reference