Regions and Tagging for Azure Managed Cache Service

Microsoft Azure Cache supports the creation and use of user-defined regions. A region is a subgroup for cached items. Regions also support the annotation of cached items with additional descriptive strings called tags. Regions support the ability to perform search operations on any tagged items in that region.

Region Considerations

Regions are optional; if you want to use them, explicitly create them in code with the CreateRegion method. After a region is created, you can add tags to objects that are inserted into the region. There are overloads on the Add and Put methods which accept a region name. To search a region for objects with a given tag, use the methods GetObjectsByTag, GetObjectsByAnyTag, and GetObjectsByAllTags.

In Managed Cache Service, the memory of the cache is distributed throughout different areas of the service. Because of architectural requirements of the search functionality, objects in a region are located in a single area of memory in the cache service. If high availability is enabled, a backup of the region exists in a different area of memory in the cache service. This behavior differs from the scenario where regions are not used. In that scenario, new items in the cache are distributed throughout all areas of memory of the cache service.

Warning

Since all items in a region are required to be located in the same area of memory of the cache service, it is possible that items could be evicted from the cache even if there appears to be sufficient remaining memory. Potentially use multiple smaller regions to realize the benefits of regions and tagging.