Is it appropriate to use Microsoft.Practices.EnterpriseLibrary.Caching with ASP.NET?
Working on a legacy ASP.NET application we've found that ASP.NET session gets used for caching some objects, but for some objects Microsoft.Practices.EnterpriseLibrary.Caching
gets used.
Is there any reason to use Microsoft.Practices.EnterpriseLibrary.Cachin开发者_运维知识库g
over standard ASP.NET Session?
Edit
In my scenario, the Enterprise Library caching is actually being used to cache per-user data by appending the ASP.NET Session ID to the cached item's key.
Session and Cache are different concepts.
If you want to share the object between all users of your site you should use Cache while Session is for storing user specific data.
So your question should not be:
Is there any reason to use Microsoft.Practices.EnterpriseLibrary.Caching over standard ASP.NET Session?
but:
Is there any reason to use Microsoft.Practices.EnterpriseLibrary.Caching over standard ASP.NET Cache?
and the answer to this question as always is: it depends on your scenario. This article provides an overview of where can the Caching Application Block be used and what issues does it try to resolve.
Yes... Session is mainly for user specific data storage in the application and cache can be used for both user specific and application specific data storages.
精彩评论