开发者

httpcache problem

I have a repository that pulls from both db, and sometimes a cache.

To implement this, I created an interface ICacheWrapper that lets the repo use HttpRuntime.Cache, AppFabric, whatever. Concrete classes of the ICacheWrapper usually take the cache in their constructor like so: new HttpCacheWrapper(HttpRuntime.Cache)

The repo's constructor takes a reference to a cache wrapper like so:

myRepo = new Repo(new HttpCacheWrapper(HttpRuntime.Cache));

If I create 2 repos, does the cache get dee开发者_JAVA技巧p copied? I would think not, but our performance problems indicate otherwise. Have I missed something here?

Thanks for any help!


What are you seeing? What does HttpCacheWrapper do with the HttpRuntime.Cache it gets passed?

I suspect that what you're seeing instead is a cache policy that holds onto things too long for the rate that things are being cached. As Raymond Chen has said, "incorrect cache policy is indistinguishable from a memory leak."

The way I would isolate this is to try to test with just one repo using the policy you have. See if your performance problems appear.

If not, then go ahead and create the 2nd repo and closely monitor memory usage.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜