在 ORM 中缓存查询结果 - 满足任意子集查询
我知道 N/Hibernate 使用缓存来满足它之前见过的查询,这称为查询缓存。 但是,它可以满足该查询的子集吗? 我想不会,因为我猜想解决这个问题的一般问题是无法确定的。
但是有什么策略可以做到这一点吗? 假设我要查询所有成本低于 20 美元的小部件。 后来,我有一个针对 10 美元以下所有小部件的查询。 显然,第二个查询结果已经被缓存(假设没有驱逐等),所以我想根据缓存的查询谓词重新评估谓词,以确定它是否“包含”它。 有一些实用的策略可以做到这一点吗?
I know N/Hibernate uses a cache to satisfy queries that it has seen before, and that is called a query cache. However, can it satisfy a subset of that query? I'd imagine not since I'd guess that the general problem of figuring that out is undecidable.
Are there any strategies for doing this, though? Say I have a query for all widgets which cost less than $20. Later, I have a query which is for all widgets under $10. Obviously the second query results would be cached already (assuming no evictions, etc.), so I'd like to just reevaluate the predicate against the cached query predicate to determine if it "contains" it. Are there some practical strategies for doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在缓存的查询结果上使用内存过滤是否很常见,例如使用 LINQ。
Is it quite common for in memory filtering to be used on cached query results, using LINQ for example.