开发者

ASP.NET 4.0 Object Caching

There are two kind of caches that need to be implemented: Global and Session Level.

  • The session level cache will store certain user specific data like Cart Items, user priviliges etc.
  • The global cache will store some data common to all the users in a subdomain.

So each subdomain will have a seperate global cache and each user(logged or not) might have a session/user specific cache.

I am thinking of using object caching features provided in 4.0 version of framework using 开发者_如何学PythonSystem.Runtime.Caching. Wrapping the basic functionality inside a custom entity.

Another thing that comes to my mind is that the singleton pattern might do the trick, not sure though.

Also to keep in mind that the Website is hosted on a web farm.

Anyone can suggest how to go about this or point me in the right direction on how to implement this?


If your site is on a web farm, then you might consider using Memcached. It's a in-memopy key=>value caching. All you have to do is prefix your session-level cached objects with the sessionID.


I think you should use distributed cache like NCache where you can keep one cache for storing sessions and the second cache for storing the objects. There is a session store provider module that you can plug in with your application and it will store the sessions in an outproc distributed cache automatically. And, you can also store your objects in a key-value pair either in the same cache or different cache by using the API.

There is a free edition available for NCache that you can download and play with http://www.alachisoft.com

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜