What is the validity period of items in HttpRuntime Cache ....?

What is the maximum expiration time we can set for an item in the HttpRuntime cache ...?
And what is the default expiration time ..?

public static void Add(string pName, object pValue) { System.Web.HttpRuntime.Cache.Add(pName, pValue, null, DateTime.Now.AddSeconds(60), TimeSpan.Zero, System.Web.Caching.CacheItemPriority.High, null); } 

In the fourth parameter above, the code is "absoluteExpiration".
What maximum value can we provide here ...?

If I provided 05/10/2014, will this item be available in the cache for this long period ...?
(This request is related to the implementation of the AppFabric cache. An attempt to replace the Httpruntime cache with the AppFabric cache).

+4
source share
2 answers

The maximum value of AbsoluteExpiration is basically NoAbsoluteExpiration. To set this, you pass it this field:

 Cache.NoAbsoluteExpiration 

Other than that, you can use whatever value you want, and it will cache it until you tell it. However, this, of course, assumes that your server does not receive a reset, you do not clear the AppFabric cache, etc. (If you will use HttpRuntime.Cache, it will also be necessary that your application be saved)

+3
source

This is the default value that the iis application pool is to be reused after a certain application interval. This will stop your application and then the cache will be empty, so setting a longer timeout than the application pool reuse timeout will have no effect. I think the caching point is not to keep the object alive forever, but to increase performance by saving them for a while.

0
source

Source: https://habr.com/ru/post/1480125/


All Articles