The topics in this section highlight the main features in the Windows Server AppFabric (WSAF) Caching APIs and demonstrates their equivalent calls in the ScaleOut StateServer NamedCache APIs.
The Soss.Client.NamedCache
class is the primary way to interact with your objects that are stored in a ScaleOut in-memory data grid. Like the AppFabric
DataCache
class, a NamedCache
instance represents a named collection of objects in the distributed data store, and it allows you to work with your objects
using familiar .NET collection syntax.
A NamedCache instance is accessed through the Soss.Client.CacheFactory
class as follows:
NamedCache cache = CacheFactory.GetCache("My Cache"); cache["Welcome"] = "Hello World!";
The CacheFactory
returns the same NamedCache
instance for each unique string identifier that is passed into the GetCache
method. In other words, your application is handed a singleton for each named cache. This allows you to set your caching
options once at application startup and then continue to use those same options throughout the life of your client application.
Tip | |
---|---|
It does not matter if you use repeatedly use the CacheFactory to acquire a |
Unlike AppFabric Caching, a ScaleOut client application is free to use the CacheFactory.GetCache
method to create as many named caches as it needs on the fly at runtime—the ScaleOut APIs do not require each named cache
to be specified in a configuration file, nor do named caches need be explicitly created through ScaleOut management tools.
A number of advanced caching features are available to your application, both at the cache level using the NamedCache
class and at the individual object level using the CreatePolicy
class.
In addition to the migration guidance laid out in the following topics, you can learn more about the API’s features in the Conceptual Overview of the .NET API Reference.