开发者

Asp.net cached objects staying in memory

I have a asp.net web forms app that uses System.Web.Caching.Cache to cache xml data from a number of web services for 2 hours.

  webCacheObj.Remove(dataCacheKey)
  webCacheObj.Insert(dataCacheKey, dataToCache, Nothing, DateTime.Now.AddHours(2), Nothing)

Every 90 minutes a Microsoft Search Server hits a pa开发者_如何学编程rticular (spider) page which calls the code to put the objects into the cache.

The issue i have is that over a period of time, the memory usage of the application grows exponentially. Lets say that in a week, the memory usage of the application pool grows to over 1gb.

I'm using IIS7 and no application pool recycling is currently enabled.


Your first stop should be here. Is a relatively short man page. Learn it, love it, live it. ;-)

That said, try this:

Cache.Insert(dataCacheKey, dataToCache, Nothing, DateTime.Now.AddHours(2), Cache.NoSlidingExpiration)

p.s. whats up with webCacheObj? Is there a reason you are not calling the static Cache?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜