I am having a MVC API project which is using a server side cache. It is deployed to Azure App Service. I was wondering to make use of App Service Local Cache to overcome challenge of keeping the cache in sync across nodes.Is this the right approach ? If yes, how do i modify the cache from my code. PS: I am not much interested in using the Redis Cache.
1 Answers
I was wondering to make use of App Service Local Cache to overcome challenge of keeping the cache in sync across nodes.
What does sync across nodes mean? Do multiple webapp applications share cache data?
HttpRuntime.Cache
can only be used in a single webapp application and cannot be accessed by other webapps. Once each cache is created, it takes up server resources. So from this point we can say: it is not that the more cache, the better. The cache has a time limit. After the expiration time set by the server, it will be recycled by the server. The cache can store any object.
So if you want to share cache data across sites, it is impossible to achieve, which is why the redis cache appears.
If you really don't want to use redis cache, then you can store the required data in sql server. This can only be an alternative, not the best.

- 15,263
- 1
- 14
- 29
-
Thanks for the answer Jason , I am having a single web application deployed over Azure App Service.On scaling that it gets deployed to multiple VM. This might cause the cache sync issue. I want to overcome this challenge. – Rishikesh Darwade Aug 22 '20 at 09:23
-
@RishikeshDarwade You can read this article. https://learn.microsoft.com/en-us/azure/architecture/best-practices/caching – Jason Pan Aug 24 '20 at 09:27