0

I am implemented In-role caching, and my application I want to use both the caches in different scenarios.

Below things are implemented: 1. Web Application - Web Role - Enabled Co-located caching 2. Cache Worker Role - Worker Role - Enabled Dedicated Caching

Now, issue is how to define both of them in Web.config file under DataCacheClients section.

 <dataCacheClients>
       <dataCacheClient name="default">
       <autoDiscover isEnabled="true" identifier=[Web Role Name] />
     </dataCacheClient>
 </dataCacheClients>

How to define here both the roles together so that I can use them simultaneously in the application?

I know we can add multiple DataCacheClient section, but that is for Named Cache. I think this is different scenario.

David Makogon
  • 69,407
  • 21
  • 141
  • 189
Mittal Patel
  • 808
  • 1
  • 22
  • 37
  • I'm curious to know as to why you would want to have both kinds of caching for your roles. Would you mind explaining please? – Gaurav Mantri Aug 13 '15 at 10:33

1 Answers1

0

Yes, you should be able to use multiple dataCacheClient to point to different cache servers.

To access different namedCache from same cache server you should use get that DataCache instance from DataCacheFactory. eg.

DataCache dc1 = dataCacheFactory.GetCache("namedCache1"); DataCache dc2 = dataCacheFactory.GetCache("namedCache1");

From https://msdn.microsoft.com/en-us/library/microsoft.applicationserver.caching.datacachefactory.getcache(v=azure.10).aspx

cacheName The named cache to use for cache operations.