HttpContext.Current.Cache configuration?

O

Olav Tollefsen

I use HttpContext.Current.Cache.Insert to add some items to the cache.

1) How can I configure how much memory that is allocated to the cache?

2) What are the defaults?

3) If I don't specifiy any expiration when calling Insert, how long will
cached elements live?

Olav
 
K

Karl Seguin

Olav:
The HttpCache shares the memory of the worker process. By default that's
60% of the total available memory.

It can be changed by editing:
C:\windows\Microsoft.NET\Framework\v1.1.4322\CONFIG\machine.config

Look for the <processModel section which allows you to control the max
memory consumption (in Windows 2003 you have more control from IIS).
Anyways, you can't allocate specifically for HttpCache,only for the entire
worker process.

If you don't specify a absolute or sliding expiration it'll use the
NoAbsoluteExpiration and NoSlidingExpiration which is the same as doing
DateTime.MaxValue...in other words it'll stay in the cache as long as it
isn't removed by ASP.Net because it needs to free up memory.

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top