禁用企业库缓存应用程序块
我们使用 Enterprise Library Caching Application Block 在我们的 Web 服务中进行缓存(在内存中)。效果很好,没有抱怨。
我们开始进行一些负载测试,我被要求禁用缓存,这样我们就可以对缓存给我们带来的性能增益有一些相对的了解。我以为这很简单 - 事实证明并非如此。
我找不到任何配置设置来禁用缓存。我想我可以关闭 MaximumElementsInCacheBeforeScavenging 设置,但是有更好的方法吗?
我发现一篇 帖子 建议创建自己的不执行任何操作的缓存管理器 -再说一遍,有更好的方法吗?
We're using the Enterprise Library Caching Application Block to do caching (in memory) in our web service. Works great, no complaints.
We're starting to do some load testing, and I've been asked to disable the cache so we can get some relative idea of what kind of performance gain caching gives us. I thought this would be simple - it turns out its not.
I can't find any configuration setting to disable the cache. I suppose I could turn down the maximumElementsInCacheBeforeScavenging setting, but is there a better way?
I found one post that suggests creating your own Cache Manager that does nothing - again, is there a better way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最好的选择是提供 ICacheManager 的自定义实现(Entlib 4 中添加的接口,对早期的接口没有帮助),它不存储任何内容,也不会产生缓存命中。然后,您配置该块以使用“NullCacheManager”或任何您想要的名称。
Your best bet is to provide a custom implementation of ICacheManager (interface added in Entlib 4, can't help for earlier ones) that doesn't store anything and never gives a cache hit. Then you configure the block to use your "NullCacheManager" or whatever you want to call it.