I’ve got our site all setup like this in my web.config:
<dataCacheClients>
<dataCacheClient name="default">
<hosts>
<host name="mysite.cache.windows.net" cachePort="22233" />
</hosts>
<securityProperties mode="Message">
<messageSecurity
authorizationInfo="{key}">
</messageSecurity>
</securityProperties>
</dataCacheClient>
</dataCacheClients>
I’d like to edit this so while I’m developing on my laptop I’m not hitting the production cache but instead a cache on my laptop.
This is a hard problem to Google (at least for me) because “azure cache local” comes up with caching on web roles.
It looks like you are using Windows Azure Shared Cache, and you want to use some local cache when developing.
It might be better to have an abstract cache layer in your system so that you can switch caches between cloud and local, rather than changing the configuration. For example, to have an interface like
ICachewith some methods likeGetItem,SetItem, etc. Then you can have some classes implemented this interface that are using in memory cache for local development, and Azure Cache for production.There’s a project named ServiceStack on GitHub that wrapped some cache implementation you can refer https://github.com/ServiceStack/ServiceStack.Contrib/tree/master/src
Alternatively, you can use the new Cloud Service Caching, which provides co-located/dedicate cache clusters alone with your cloud services (web role and worker role). It has full local emulator support which means you don’t need to change any code and any configuration between local development (use local cache emulator) and production.
For more information about this Cloud Service Caching you can refer https://www.windowsazure.com/en-us/develop/net/how-to-guides/cache/