Configure In-Role Cache (Azure Cache)
Updated: February 28, 2014
This topic describes how to configure role-based In-Role Cache on Microsoft Azure Cache. Configuration includes two distinct tasks.
Configure a Microsoft Azure role to host In-Role Cache. This step includes creating named caches and configuring the settings of those named caches. This provides the caching capabilities to any of the roles in the same cloud service deployment.
Configure any roles that require caching. This includes adding assembly references and settings in the configuration file that point to the role that hosts In-Role Cache.
For more details on Cache configuration, see Configuration Model (In-Role Cache for Azure Cache).
To use role-based In-Role Cache, you must first configure a role to host caching. This could be a new Cache Worker Role that you add to your cloud service, referred to as a dedicated topology. Dedicated role caching is supported on worker roles. For details on configuring a dedicated topology in Visual Studio, see Hosting In-Role Cache on Dedicated Roles (Azure Cache).
Alternatively, you can choose to use an existing role that has available physical resources to share with In-Role Cache. This is referred to as a co-located topology. Co-located role caching is supported on web roles and worker roles. For details on configuring a co-located topology in Visual Studio, see Hosting In-Role Cache on Existing Roles (Azure Cache).
The final step is to create any additional named caches and to configure each cache. For more information, see How To: Configure Azure Caching.
|Configuring the role in Visual Studio results in configuration changes to the underlying ServiceConfiguration.cscfg and ServiceDefinition.csdef files. For more information, see Configuration Model (In-Role Cache for Azure Cache). For manual configuration of the ServiceConfiguration.cscfg file, see In-Role Cache Role Configuration Settings (ServiceConfiguration.cscfg).|
Any other code in the cloud service can access the named caches as cache clients. The configuration steps here typically include:
Reference the appropriate Cache assemblies.
Add Cache configuration settings to application or web.config configuration files.
For examples of the client configuration file settings, see Configuration Model (In-Role Cache for Azure Cache).
|These steps are simplified by the use of a NuGet package to configure a project to become a cache client. For more information, see How to: Prepare Visual Studio to Use In-Role Cache (Azure Cache). For manual configuration of the web.config and application.config files, see In-Role Cache Client Configuration Settings (Web.config).|
In This Section
Configuration Model (In-Role Cache for Azure Cache)
Other ResourcesHow To: Use Azure Caching