Eksportuj (0) Drukuj
Rozwiń wszystko
Ta zawartość nie jest dostępna w wymaganym języku. Wersja w języku angielskim znajduje się tutaj.

Develop for Azure Managed Cache Service

Updated: July 16, 2010

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

Managed Cache Service provides a set of APIs to add, update, and remove items from a cache. Using the classes and methods in the Microsoft.ApplicationServer.Caching namespace is a direct way of interacting with a cache. Whereas, using one of the ASP.NET providers is an indirect way of using a cache. The topics in this section cover direct programmatic use of Managed Cache Service. For more information about the ASP.NET providers for Managed Cache Service, see ASP.NET 4 Cache Providers for Azure Managed Cache Service.

Programming Model

The Managed Cache Service programming model is designed for the cache-aside programming pattern. If your data is not present in the cache, your application, and not the distributed cache, must reload data into the cache from the original data source.

Cache-aside Programming Considerations

Design application code to function independent of the cache, so that the application continues to function if the cached data is not available. Because data in the cache is not persisted in a durable fashion, the possibility exists that the data in the cache could be unavailable. For example, if a cache is scaled to a different cache offering, the cached items in memory are lost. Requesting an item that does not exist in the cache is referred to as a cache miss.

When using the Managed Cache Service high availability feature, backup copies of cached items help to guard against machine and process failures on a cache. Even with high availability enabled, there is a chance, no matter how remote, that all cache data is lost due to a major disaster event. Items that require persistence must use a database or other persistent-storage techniques. For more information, see High Availability for Azure Managed Cache Service.

There are many other reasons that your code might encounter a cache miss. For example, the cache item might have expired or been evicted based on normal expiration and eviction policies. Regardless of the reason, the application code must be able to access the original data source to repopulate the item in the cache. For more information, see Expiration and Eviction for Azure Managed Cache Service.

In this section

See Also

Zawartość społeczności

© 2014 Microsoft