AppFabric Caching Logical Architecture Diagram (AppFabric 1.1 Caching)
The logical architecture of the cache cluster in Microsoft AppFabric 1.1 for Windows Server consists of named caches, regions, and cached objects. In the following diagram, named caches span all the cache hosts in the cluster, but regions are limited to just one cache host in the cluster.
A named cache, also referred to as a cache, is a configurable unit of in-memory storage that all applications use to store data in the distributed cache. You can configure one or more named caches for each of your applications. Each cache can be configured independent of the others, which lets you optimize the policies of each cache for your application.
As you see in the previous diagram, each cache spans all cache hosts in the cluster. When the AppFabric Caching features are first set up, a cache comes pre-configured with the name "default." You can store data in this default cache, or you can create and use named caches.
All caches are defined in the cluster configuration. Use the Windows PowerShell administration tool to create or reconfigure caches. Some settings can only be configured when you first create the cache. Other settings can be changed later, but may require the entire cache cluster to be restarted. For more information about the Windows PowerShell cmdlets, see Using Windows PowerShell to Manage AppFabric 1.1 Caching Features.
|There is a limit of 128 named caches.|
|Restarting your cache cluster causes all data to be flushed from all named caches in the cluster, but the named caches themselves are persisted.|
Regions are an additional data container that you can place in the cache. Regions are a cache construct: they are not defined in the cluster configuration settings. Regions are optional; if you want to use them, you must explicitly create them at run time with your application code by using the CreateRegion method. For more information, see Basic Cache Methods.
With regions, you can retrieve cached objects in other ways than by using the specific key value with which they were cached. Regions let you search all cached objects in the region by using descriptive strings called tags. You can associate one or more tags to each object stored in the cache. For more information, see Tag-Based Methods.
To provide this added search functionality, objects in a region are limited to a single cache host. Thus, applications that use that data cannot realize the scalability benefits of a distributed cache. In contrast, if you do not specify a region, cached objects can be load balanced across all cache hosts in the cache cluster.
Regions offer searching capabilities, but by limiting cached objects to a single cache host, the use of regions presents a trade-off between functionality and scalability.
Objects retrieved from the cache cluster take the form of their System.Object base class, requiring type conversion to restore them to their original type. When an object is in the cache, the cache cluster associates additional information with it. This includes keys, tags, version numbers, and on which cache and region the object is stored. For basic cache operations, you do not have to return this additional information to your cache-enabled application. For tag-based or concurrency operations, you might have to retrieve the Tags or Version associated with your object.
The GetCacheItem method is provided to retrieve all the information associated with your cached object and package it in the form of a DataCacheItem object. For more information about the available APIs, see Cache Client API Overview.