I'd like to modify the value of m开发者_C百科y Sliding Expiration time span based on how much memory is available. If the site's traffic is high at any point in time, more data will be added to the cache than during quieter periods. During those quiet periods I can increase the sliding expiration time span, thus allowing data to be stored longer. But when the site is busy I need to free up memory so I'm happier with a shorter time span.
So I guess my questions are as follows:
Is it possible for me to find out how much memory is being consumed by the items I've added to HttpRuntime.Cache
? If so, how?
Does this sound like a realistic solution to the problem I've described?
It's unlikely you can come up with a good algorithm for 'helping' the Cache this way.
Just make appropriate use of the priority parameter and let the Cache do its job.
精彩评论