httpruntime.cache

Has using the HttpRuntime.Cache changed in ASP.NET MVC?

So, I was looking over my standard cache utility when preparing to unit test a controller and thought, hey, is accessing the HttpRuntime.Cache directly considered harmful in MVC? I wrap the cache in a proxy class that implements a cache-like interface (tho much simpler) so that I can mock it during tests. But I'm wondering if that's al...

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? ...

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 cache things? ...

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? ...

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 Simulate a Windows Service using ASP.NET to run scheduled jobs Omar uses the HttpContext to ...

WCF Service hosted in IIS - Can't seem to cache or retain state?

Hello, I'm trying to cache some application data that only needs to be instantiated when the application starts. I've tried using HttpRuntime.Cache, creating a static object that is instantiated only when the service starts, and I've tried making the service singleton and using global variables. Every time a new request hits the servic...

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 to save hitting the database on every request. However, when the administrator changes th...

Can I share HttpRuntime.Cache between applications?

I have a website setup like this: /Web --this is the client facing site /Web/Admin --this is the backend system and is setup as a Virtual Application I'm using HttpRuntime.Cache for caching calls to the database. What I want to be able to do is clear something that is cached on the /Web site from the /Web/Admin site. It appea...

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 is null and act accordingly. I've been using this call for a long time. Recently, for...

ASP.NET: HttpRuntime.Cache getting flushed when saving WebConfigurationManager -- Is this a bug?

Recently, I've been experimenting with caching objects with HttpRuntime.Cache and I was generally under the impression that if I "added" something to the cache like this: HttpRuntime.Cache.Insert("Test", "This is a test!", null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, new CacheI...