Data cache vs session object in ASP.Net

前端 未结 5 1189
眼角桃花
眼角桃花 2021-01-02 03:53

Should dynamic business objects for a site be stored in the users session or use ASP.Net caching (objects such as orders, profile information etc)?

I have worked wi

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-02 04:43

    The ASP.NET system cache is global to the application where as the session is unique to the current user. If you chose to use the global cache to store objects you would need to create an object identification strategy so you could get the correct objects for your per user basis.

    If you are looking to enhance performance you would be better off replacing the ASP.NET session state with a distributed memory cache such as Microsoft's velocity. Microsoft has posted articles on how to replace session usage to target Velocity. You could also use Memcache or other similar products in a related fashion.

提交回复
热议问题