Is the HttpContext.Current.Cache available to all sessions

前端 未结 2 1602
一整个雨季
一整个雨季 2021-02-07 05:06

As per title. I want to be able to save some data in a cache object but this object must be available to all users/sessions and can expire.

What is the best method to a

2条回答
  •  星月不相逢
    2021-02-07 05:17

    HttpContext.Current.Cache will be present, but Current should only be used if you cant get to your context member.

    Also to answer your second question, yes, the Cache object is global to the application.

    Here's a good intro to caching...

    How to cache in ASP.NET by using Visual C# .NET

    and...

    Caching with ASP.NET . Don't skip part 2, "Data Caching"

提交回复
热议问题