I’ve been working recently on configuring .net 1.1 ASP caching for a customer. I remembered through this article that absolute expiry isn’t exactly what it seems. Its a real pain sometimes forgetting things – so this blog can act as some sort of pseudo memory for me; hopefully I wont hit this problem again!
Basically the use of absolute expiry, doesn’t actually expire the entry in the cache based on any timed event. Rather the scavenger process (which is hard to find specifics around) will clean up based on memory usage (specified in ASP configuration). Secondly, if programatically one accesses the cache entry the thread is logically hijacked if a callback is required. Your thread now goes behind the scenes and runs the call back before giving you the result. This means one should be very careful when writing call back code
1) the code may not be called for some time after the expiry actually occurred
2) the code should be designed to avoid adding data back into the cache
General notes on Scavenging Cache Entries
Scavenging means that the cache attempts to remove infrequently used or unimportant items if memory becomes scarce.
Programmers who want to control how scavenging occurs can provide hints to the scavenger when items are inserted into the cache that
indicate the relative cost of creating the item and the relative rate at which the item must be accessed to remain useful.
The following web configuration can be used: