1
我想在我的Web應用程序的所有用戶之間共享一個隊列數據結構,而不使用任何數據庫。我希望這些數據在所有用戶之間始終可用且線程安全。緩存一個好主意?我嘗試使用System.Web.Caching致電:如何在ASP .NET MVC 2.0中使用數據緩存
Queue<int> users= new Queue<int>();
Context.Cache.Insert("users", users, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration);
我Global.axax文件
,但是當我打電話緩存在我的.cs文件:
((Queue<int>) Cache["users"]).Enqueue(newUser);
我得到以下錯誤:
'System.Web.Caching.Cache' is a 'type' but is used like a 'variable'
我是否正確使用緩存?
謝謝!