Sdílet prostřednictvím


DataCacheFactory.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)

Usage

'Usage
Dim instance As DataCacheFactory
Dim cacheName As String
Dim returnValue As DataCache

returnValue = instance.GetCache(cacheName)

Syntax

'Declaration
Public Function GetCache ( _
    cacheName As String _
) As DataCache
public DataCache GetCache (
    string cacheName
)
public:
DataCache^ GetCache (
    String^ cacheName
)
public DataCache GetCache (
    String cacheName
)
public function GetCache (
    cacheName : String
) : DataCache

Parameters

  • cacheName
    The named cache to use for cache operations.

Return Value

The cache client, an instance of the DataCache object.

Remarks

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. For more information about configuration options and settings for the cache client, see Configuration (Windows Server AppFabric Caching).

Note

Before working with the cache, you must first create the named cache with the New-Cache command of the PowerShell based cache administration tool. Cache names are case sensitive; make sure that the case of the specified cache is the same as shown with the Get-Cache command. Use the Get-Cache command without passing any parameters to find out which caches are present in the cluster. For more information, see Cache Administration with PowerShell (Windows Server AppFabric Caching).

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Visual Studio 2010 and later, .NET Framework 4

Target Platforms

Windows 7; Windows Server 2008 R2; Windows Server 2008 Service Pack 2; Windows Vista Service Pack 2

Change History

See Also

Reference

DataCacheFactory Class
DataCacheFactory Members
Microsoft.ApplicationServer.Caching Namespace

  ff425062(v=azure.10).md 2011-08-26