[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

How to limit the memory size for asp.net cache

ningjun.wang

1/17/2007 4:42:00 AM

I set outputcache to 30 minutes for all .aspx pages on my asp.net 2.0
websites. If a search engine (such as Google) crawl my site, it can hit
thousands of pages within a few minutes and thus produce a large amount
of page caches. This could use a lot of memory and impact other
websites running on the same machine. My question is: how can I limit
the memory size (e.g. to 100MB) used by the cache?

I can set the following in web.config:
<cache privateBytesLimit = "128000000" />

This means the cache starts flushing expired items and attempting to
reclaim memory when memory size exceed 100MB. However if all cached
pages are unexpired, then no memory are reclaimed and memory size will
continue to grow as new pages get cached. How can I force cache to
remove items even if they are not expired yet so that memory will never
exceed 100MB? Is there a configuration setting to achieve this?

Ningjun

1 Answer

Alvin Bruney [MVP]

1/20/2007 11:48:00 AM

0

Answered in ASP.NET framework.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc


<ningjun.wang@lexisnexis.com> wrote in message
news:1169008931.533887.280620@m58g2000cwm.googlegroups.com...
>I set outputcache to 30 minutes for all .aspx pages on my asp.net 2.0
> websites. If a search engine (such as Google) crawl my site, it can hit
> thousands of pages within a few minutes and thus produce a large amount
> of page caches. This could use a lot of memory and impact other
> websites running on the same machine. My question is: how can I limit
> the memory size (e.g. to 100MB) used by the cache?
>
> I can set the following in web.config:
> <cache privateBytesLimit = "128000000" />
>
> This means the cache starts flushing expired items and attempting to
> reclaim memory when memory size exceed 100MB. However if all cached
> pages are unexpired, then no memory are reclaimed and memory size will
> continue to grow as new pages get cached. How can I force cache to
> remove items even if they are not expired yet so that memory will never
> exceed 100MB? Is there a configuration setting to achieve this?
>
> Ningjun
>