Dışarıya aktar (0) Yazdır
Tümünü Genişlet
EN
Bu içerik dilinizde bulunmamaktadır ancak İngilizce sürümüne buradan bakabilirsiniz.

How to: Create a Cache for Azure Managed Cache Service

Updated: July 16, 2010

noteNote
For guidance on choosing the right Azure Cache offering for your application, see Which Azure Cache offering is right for me?.

The topic provides a walkthrough of creating and configuring a cache for Azure Managed Cache Service.

Creating a Cache

There are three basic steps to perform when creating a cache. The first step is to choose the cache offering that meets your application's cache requirements. The second step is to create the cache. Once the cache is created, it is ready to use with default settings. The third step is to configure the cache to use any features such as notifications or high availability it so that is can better meet your application's requirements.

Choose a Cache Offering

Managed Cache Service is available in the following three offerings.

  • Basic - Cache in sizes from 128MB to 1GB in 128MB increments, with one default named cache

  • Standard - Cache in sizes from 1GB to 10GB in 1GB increments, with support for notifications and up to ten named caches

  • Premium - Cache in sizes from 5GB to 150GB in 5GB increments, with support for notifications, high availability, and up to ten named caches

noteNote
Each offering differs in terms of pricing and features. For more information see Cache Service Pricing FAQ.

If your application requires notifications, then choose the Standard or Premium cache offerings, and if your application requires high availability, choose the Premium offering.

noteNote
You can always scale a cache up or down, in both size and cache offering, if the needs of your application change. For more information, see Scale a Cache for Azure Managed Cache Service.

Create the Cache

Cache instances in Managed Cache Service are created using PowerShell scripts.

ImportantImportant
Once a Managed Cache Service instance is created using the PowerShell cmdlets it can be viewed and configured in the Azure Management Portal.

To create a Managed Cache Service instance

  1. Open an Azure PowerShell command window.

    noteNote
    For instructions on installing and using Azure PowerShell, see How to install and configure Azure PowerShell.

  2. Invoke the Add-AzureAccount cmdlet, and enter the email address and password associated with your account.

    noteNote
    If you have configured Azure PowerShell with a certificate for your account then you can skip this step. For more information about connecting Azure PowerShell with your Azure account, see How to install and configure Azure PowerShell.

  3. Invoke the New-AzureManagedCache cmdlet and specify the name, region, cache offering, and size for the cache. In the following example, a Basic 128MB cache is created with name contosocache, in the South Central US geographic region.

    New-AzureManagedCache -Name contosocache -Location "South Central US" -Sku Basic -Memory 128MB
    
    noteNote
    For a complete list of parameters and values that can be used when creating a cache, see the New-AzureManagedCache cmdlet documentation.

  4. Once the PowerShell cmdlet is invoked, it can take a few minutes for the cache to be created. After the cache has been created, your new cache has a Running status and is ready for use with default settings, and can be viewed and configured in the Azure Management Portal. To customize the configuration of your cache, see the following Configure the Cache section.

    You can monitor the creation progress in the Azure PowerShell window. Once the cache is ready for use, the New-AzureManagedCache cmdlet will display the cache information, as shown in the following example.

    PS C:\> Add-AzureAccount
    VERBOSE: Account "user@domain.com" has been added.
    VERBOSE: Subscription "MySubscription" is selected as the default subscription.
    VERBOSE: To view all the subscriptions, please use Get-AzureSubscription.
    VERBOSE: To switch to a different subscription, please use Select-AzureSubscription.
    PS C:\> New-AzureManagedCache -Name contosocache -Location "South Central US" -Sku Basic -Memory 128MB
    VERBOSE: Intializing parameters...
    VERBOSE: Creating prerequisites...
    VERBOSE: Verify cache service name...
    VERBOSE: Creating cache service...
    VERBOSE: Waiting for cache service to be in ready state...
    
    
    Name     : contosocache
    Location : South Central US
    State    : Active
    Sku      : Basic
    Memory   : 128MB
    
    
    
    PS C:\>
    

Configure the Cache

Managed Cache Service supports named caches, which provide you the flexibility to configure different cache options for different sets of data. Every cache has a default named cache, and in the Standard and Premium cache offerings, up to nine additional named caches can be configured. Each named cache has its own individual settings, such as high availability, notifications, and custom eviction and expiration policies. Named cache settings are configured in the Management Portal on the Configure tab for Cache.

Named Caches in Windows Azure Cache Service

The following table provides an overview of Managed Cache Service features.

 

Feature Description

Name

A default cache is configured, and in the Standard and Premium cache offerings, up to nine additional named caches can be configured if desired.

Expiry Policy

There are three types of Expiry Policy: Never, Absolute, and Sliding. When Absolute is specified, the expiration interval specified by Time (min) begins when items are added to the cache. When Sliding is specified, the interval is reset each time an item is accessed in the cache. When None is specified, Time (min) must be set to 0, and items will not expire. The default is Absolute.

For more information, see Expiration and Eviction for Azure Managed Cache Service.

Time (min)

The default expiration for items in the cache is 10 minutes, but it is configurable. The expiration time for individual items added to the cache can also be specified using overloads of Add and Put when items are added to the cache. Tim (min) works in conjunction with Expiry Policy to determine when items expire.

Notifications

Notifications allow your application to receive asynchronous notifications when various cache operations occur in the cache.

Notifications are available in the Standard and Premium cache offerings, and are not available in the Basic cache offering. For more information, see Cache Offerings for Azure Managed Cache Service and Notifications for Azure Managed Cache Service.

High Availability

Provides high availability for items in the cache. If items are lost due to a failure, backup copies of the items in the cache are still available.

High availability is only available in the Premium cache offering, and is not available in the Basic or Standard cache offerings. For more information, see Cache Offerings for Azure Managed Cache Service and High Availability for Azure Managed Cache Service.

Eviction

Choices are Enabled, which uses a LRU (last recently used) algorithm to determine which items to evict, or Disabled. The default is Enabled.

Once your cache is created and configured, you can connect to it from your client applications. For more information, see Configure cache clients for Azure Managed Cache Service.

Topluluk İçeriği

Ekle
Show:
© 2014 Microsoft