iBATIS 中的无限刷新间隔
有谁知道当忽略了flushInterval时iBATIS cacheModel的行为是什么,比如说缓存类型是MEMORY? 我希望它只是将缓存结果无限期地保留在内存中。 我有一组结果,如果不重新启动服务器,这些结果就永远不会改变,并且我希望在应用程序的生命周期内只查询一次它们。 我在想,如果我将 flashInterval 元素保留在缓存映射之外,这会起作用......但我在文档中找不到任何内容来确认这一点。
Does anyone know what the behavior of an iBATIS cacheModel is when flushInterval is left out, say if the cache type is MEMORY? I'm hoping that it simply leaves the cached results in memory indefinitely. I have a set of results that will never change without a server restart, and I'm hoping only to query for them once during the lifetime of the app. I was thinking that if I left the flushInterval element off the cache map, this would work...but I can't find anything in the documentation to confirm that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 Ibatis 源代码 和 Ibatis 用户指南
如果 CacheModel 中没有设置 flashInterval,则将其设置为 NO_FLUSH_INTERVAL,即-99999 并且不是用户指南建议的正毫秒数。 通过此设置,缓存仅通过调用语句(执行时刷新)或显式调用刷新命令(如果您覆盖 Ibatis)来刷新。
为了获得您想要的行为,您还需要指定一个
CacheModel 中的
,有关详细信息,请参阅 此处。
From the Ibatis source code and the Ibatis User Guide
If flushInterval is not set in the CacheModel, then it is set to NO_FLUSH_INTERVAL which -99999 and isn't a positive number of milliseconds like the User Guide recommends. With this setting the cache is only flushed by calls to statements (flush on execute) or explicit calls to the flush command if you are overriding Ibatis.
In order to get the behaviour you desire you will also need to specify a
<property name="Type" value="STRONG"/>
in your CacheModel , for more information see here.