c# - ASP.NET MVC Application Variables? -


Are there application variables in ASP.NET? I want to store an object for all users which should be updated independently every 5 minutes. But all users should always look at its final version. Any suggestions (C #)?

You can store application-wide data in ASP.NET.

Add your item to the cache using the method. Set Sliding End Value in 5-minute Timespace Write a cover class to access the object in the cache. The wrapper class can provide a method for obtaining object cache.

For example:

  public static class CacheHelper {get public static MyObject} () {MyObject obj = HttpRuntime.Cache.Get ("myobject") of MyObject in the form of; If (obj == faucet) {// Create an object to be inserted into the cache obj = CreateObjectByWhateverMeansNecessary (); HttpRuntime.Cache.Insert ("myobject", obj, null, dateTime.Now.AddMinutes (5), system.web.Caching.Cache.NoSlidingExpiration); } Return obj; }}  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -