SALES: 1-800-867-1380

GetCache Method

Returns the cache client, an instance of the DataCache object.

Namespace:  Microsoft.ApplicationServer.Caching
Assembly:  Microsoft.ApplicationServer.Caching.Client (in Microsoft.ApplicationServer.Caching.Client.dll)

public DataCache GetCache(
	string cacheName
)

Parameters

cacheName
Type: System..::..String
The named cache to use for cache operations. For , the cache name must be “default”, which is the same as calling GetDefaultCache.

Return Value

Type: Microsoft.ApplicationServer.Caching..::..DataCache
The cache client, an instance of the DataCache object.

Before working with the cache, you must instantiate the DataCacheFactory class.

The cache client returned by this method can be configured programmatically, or by the application configuration file. When a DataCacheFactoryConfiguration parameter is passed to the DataCacheFactory class constructor, those configuration settings are used for all cache clients obtained from that DataCacheFactory object. Configuration parameters passed to the constructor override settings specified in the application configuration file. If no parameters are provided to the DataCacheFactory class constructor, the cache client configuration parameters come from the application configuration file.

NoteNote

Before working with a named cache, you must first create it. In Microsoft AppFabric 1.1 for Windows Server Caching, you create the cache with the New-Cache Windows PowerShell. You can also use the Get-Cache command with no parameters to get a list of caches on an on-premises cache cluster. Cache names are case sensitive.

Caution noteCaution

In Windows Azure Caching, you configure the named caches as part of the cloud service configuration.

NoteNote

Windows Azure Shared Caching supports only the default cache. However, you still need to create a namespace for each cache.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft