System.Web.Caching.Cache is not a distributed caching mechanism. If you plan to use caching in web garden or web farm scenarios, then forget about this caching library. In that case you need something more robust like
AppFabric or memcached. Each w3wp process will have it's own caching contents if you use System.Web.Caching.Cache, thus creating stale and outdated data because in one instance you might be on process 1, while in the other
you might be in process 2. If you update process 2, process 1 will stay with old data. And you have a problem.
Marked as answer by NoVoLuMe on Mar 06, 2013 08:11 AM
NoVoLuMe
Member
3 Points
9 Posts
Is System.Web.Caching.Cache Shared?
Feb 28, 2013 09:00 AM|LINK
Hi this is my first thread.
Is System.Web.Caching.Cache shared between all w3wp proccess?
Thanks.
mm10
Contributor
6455 Points
1187 Posts
Re: Is System.Web.Caching.Cache Shared?
Feb 28, 2013 09:03 AM|LINK
"One instance of this class is created per application domain, and it remains valid as long as the application domain remains active"
Link: http://msdn.microsoft.com/en-us/library/system.web.caching.cache.aspx
NoVoLuMe
Member
3 Points
9 Posts
Re: Is System.Web.Caching.Cache Shared?
Feb 28, 2013 10:23 AM|LINK
i know and i have read all of this page.
if an application domain has one more wp3wp proccess what will be Cache behaviour? it is shared between those proccess or not?
i want to say why i am asking this question.
because of this post
Pbalan.in
Contributor
2144 Points
484 Posts
Re: Is System.Web.Caching.Cache Shared?
Feb 28, 2013 11:15 AM|LINK
Read this below article...
http://msdn.microsoft.com/en-us/library/system.web.caching.cache.aspx
NoVoLuMe
Member
3 Points
9 Posts
Re: Is System.Web.Caching.Cache Shared?
Mar 01, 2013 06:09 AM|LINK
Please read previous posts before reply.
Thanks.
mm10
Contributor
6455 Points
1187 Posts
Re: Is System.Web.Caching.Cache Shared?
Mar 01, 2013 07:10 AM|LINK
Your cached objects will be stored in the address space of w3wp.exe so you will have a cache per process.
Huske
Contributor
4070 Points
761 Posts
Re: Is System.Web.Caching.Cache Shared?
Mar 05, 2013 04:26 PM|LINK
System.Web.Caching.Cache is not a distributed caching mechanism. If you plan to use caching in web garden or web farm scenarios, then forget about this caching library. In that case you need something more robust like AppFabric or memcached. Each w3wp process will have it's own caching contents if you use System.Web.Caching.Cache, thus creating stale and outdated data because in one instance you might be on process 1, while in the other you might be in process 2. If you update process 2, process 1 will stay with old data. And you have a problem.
NoVoLuMe
Member
3 Points
9 Posts
Re: Is System.Web.Caching.Cache Shared?
Mar 06, 2013 08:16 AM|LINK
Thank you very much. I think so but i was not sure.
I already use memcached but it is very slow on network. Apfabric's warm-up time is very long. When i need to restart appfabric i wait for along time.
Now, I want to extract memcached from my project. I will manage Cache object carefully.
Thank you very much.
NoVoLuMe
Member
3 Points
9 Posts
Re: Is System.Web.Caching.Cache Shared?
Mar 11, 2013 08:59 AM|LINK
I wanto ask same question for HttpApplicationState.
Would you like to answer?
Thanks.
Sincerely
Huske
Contributor
4070 Points
761 Posts
Re: Is System.Web.Caching.Cache Shared?
Mar 11, 2013 09:21 AM|LINK
Sure, ask.