Book Image

Microsoft Azure Development Cookbook Second Edition

Book Image

Microsoft Azure Development Cookbook Second Edition

Overview of this book

Table of Contents (15 chapters)
Microsoft Azure Development Cookbook Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Building a simple cache for applications


Azure Cache is a managed service with (at the time of writing this book) the following three offerings:

  • Basic: This service has a unit size of 128 MB, up to 1 GB with one named cache (the default one)

  • Standard: This service has a unit size of 1 GB, up to 10 GB with 10 named caches and support for notifications

  • Premium: This service has a unit size of 5 GB, up to 150 GB with ten named caches, support for notifications, and high availability

    Tip

    Different offerings have different unit prices, and remember that when changing from one offering to another, all the cache data is lost. In all offerings, users can define the items' expiration.

The Cache service listens to a specific TCP port. Accessing it from a .NET application is quite simple, with the Microsoft ApplicationServer Caching library available on NuGet. In the Microsoft.ApplicationServer.Caching namespace, the following are all the classes that are needed to operate:

  • DataCacheFactory: This class...