如何刷新 EntLib 缓存进程中的所有缓存
我想知道是否有一种方法可以告诉企业库缓存对象刷新所有配置的缓存以刷新该进程。
即使枚举该进程的所有已配置缓存,并手动刷新每个缓存,也可以,但是 EntLib.Caching 是否有一种 API 方法可以为我提供这些值?
或者我需要自己通过配置文件进行枚举吗?
I'd like to know if there is a way to tell the Enterprise Library Caching objects to flush all configured caches for that process to flush.
Even enumerating through all of the configured caches for that process, and manually flushing each one, is ok, but is there an API method from EntLib.Caching that will give me those values?
Or do I need to enum through the config file myself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个怎么样:
How about this:
我不认为有办法刷新所有缓存。 回收应用程序池可以做到这一点,但这也会导致您的代码需要 JIT 编译。
我们通常将缓存的名称存储在常量中,以避免名称在代码中的多个位置进行硬编码,如果将名称存储在可枚举数据类型中,则可以一次遍历它并刷新它们。
I do not think that there is a way to flush all caches. Recycling the application pool would do it, but this would also cause your code to require a JIT compile.
We normally store the names of the caches in constants, to avoid the name being hardcoded several places in the code, if you store the names in an enumerable data type you could just go through it and flush them one at a time.