Questions tagged [httpruntime.cache]
53 questions
41
votes
1 answer
Should I use HttpRuntime.Cache?
I'm a beginner in asp.net, and have a few question of Cache:
HttpRuntime.Cache only provides severals methods and I think I'm able to implement these methods with Dictionary by myself.
If HttpRuntime.Cache is much better than Dictionary, why some…

Domi.Zhang
- 1,675
- 4
- 21
- 27
30
votes
3 answers
HttpRuntime.Cache[] vs Application[]
I know that most people recommend using HttpRuntime.Cache because it has more flexibility... etc. But what if you want the object to persist in the cache for the life of the application? Is there any big downside to using the Application[] object to…

Jon Tackabury
- 47,710
- 52
- 130
- 168
20
votes
4 answers
HttpRuntime.Cache best practices
In the past I have put a lock around accessing the HttpRuntime.Cache mechanism.
I'm not sure if I had really researched the issue in the past and blindy surrounded it with a lock.
Do you think this is really necessary?

Andrew Harry
- 13,773
- 18
- 67
- 102
20
votes
1 answer
Cache key causes error "Negating the minimum value of a twos complement number is invalid."
This is one of the strangest errors I've ever seen.
I'm doing a very simple call to return values from the HttpRuntime cache. The call is:
return HttpContext.Current.Cache[cacheKey];
If it returns null, that's fine. I check if the returned value…

sohtimsso1970
- 3,216
- 4
- 28
- 38
19
votes
3 answers
What's the difference between the HttpRuntime Cache and the HttpContext Cache?
I know there is a very similar question here but I was hoping to get a better explination. Why would I ever use HttpContext.Cache instead of HttpRuntime.Cache if the HttpContext really uses the HttpRuntime.Cache behind the scenes?
In the article…

Micah
- 111,873
- 86
- 233
- 325
14
votes
2 answers
View the data cached in System.Web.HttpRuntime.Cache
Is there any tool available for viewing cached data in HttpRunTime cache..? We have an Asp.Net application which is caching data into HttpRuntime Cache. Default value given was 60 seconds, but later changed to 5 minutes. But feels that the cached…

Sunil
- 2,885
- 5
- 34
- 41
7
votes
3 answers
Read HttpRuntime.Cache item as read-only
I am using a HttpRuntime.Cache to store a list of objects that will be accessing frequently across sessions.
I use the following line of code to get the item from the cache:
List _chartData =
…

Libin TK
- 1,477
- 2
- 25
- 46
5
votes
4 answers
Null as value in HttpRuntime.Cache.Add
I want to store null for some of the keys in HttpRuntime.Cache as I dont want to again go to Database to find that there is no entry for that key.
So first time, it goes to database and fills the cache. The intent is to serve the following calls…

user_v
- 9,628
- 4
- 40
- 32
5
votes
2 answers
How can I get the size of an object in the HttpRuntime.Cache?
I am currently storing many different types of objects in the ASP.NET HttpRuntime.Cache and I was wondering if there is a way to figure out how big each object is?

Jon Tackabury
- 47,710
- 52
- 130
- 168
5
votes
1 answer
Scope of HttpRuntime.Cache
Is it possible to retrieve HttpRuntime.Cache from another application?
i am having two applications ,
for example App-A, App-B
in App-A i am inserting values to cache
HttpRuntime.Cache.Insert(sCacheKey, sCacheValue, Nothing,…

Jay
- 1,317
- 4
- 16
- 40
5
votes
2 answers
What is the expiration period of items in HttpRuntime Cache....?
What is the maximum expiration time we can set to an item in HttpRuntime Cache...?
Also what is the default expiration time..?
public static void Add(string pName, object pValue)
{
System.Web.HttpRuntime.Cache.Add(pName, pValue, null,…

Sunil
- 2,885
- 5
- 34
- 41
4
votes
2 answers
HttpRuntime.Cache.Remove doesn't remove cache
I am trying to remove the cache using the HttpRuntime.Cache.Remove(key) but invain. I wonder what are the best practices for using HttpRuntime.Cache.
Regards

code master
- 2,026
- 5
- 30
- 49
4
votes
2 answers
Sharing an HttpRuntime.Cache across two IIS applications
I have two ASP.NET 2.0 applications in IIS; a public booking system and an admin system to manage prices. There is a shared DLL project that accesses the database, used by both applications.
To improve performance, the prices are cached in DLL code…

harriyott
- 10,505
- 10
- 64
- 103
3
votes
0 answers
Replacing HttpRuntime.Cache.Insert with redis
I have some inherited code still running on .net framework 4.7.2 its a webapi. This runs in aws in windows containers. The calls to it are resource intensive and thus there is quite a bit of caching the caching its using HttpRuntime.Cache.
Issue we…

Ismail
- 923
- 2
- 12
- 29
3
votes
2 answers
Sharepoint Timer Job and access to the HTTPRuntime Cache object
I am planning to create a Sharepoint Timer Job and configure it to run on all of our farm web front end machines.
The timer job will read data from the SP SQL Server instance and hopefully update it into the HTTPRuntime cache object on the 2 Web…

Paul Duer
- 1,100
- 1
- 13
- 32