拉伊洛;指示缓存的查询是否已刷新

发布于 2024-12-13 10:48:23 字数 381 浏览 9 评论 0原文

初始情况: 在函数内部,我使用 cachedWithin 属性缓存查询。 在 cfquery 标签正下方,我将派生的相关数据缓存到存储在 SERVER 范围 中的结构中。

问题: 如果上面的查询已刷新,我想重新填充该结构,但 foo.cached 似乎仅指示标记是否完全使用缓存。 Railo 是否提供额外的元数据,以便在该查询已更新时实际接收 true,而不仅仅是它已被缓存,还是我应该诉诸 cfcache 解决方法?

Initial situation:
Inside a function I'm caching a query using the cachedWithin attribute.
Right below that cfquery tag I'm caching derived&related data into a struct stored in the SERVER scope.

Problem:
I want to re-populate that struct if the query above has been refreshed, but foo.cached only seems to indicate whether the tag uses caching at all.
Does Railo provide additional metadata to actually receive true if that query has been updated, not just if it's cached at all or should I resort to a cfcache workaround?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柳若烟 2024-12-20 10:48:24

我相信 result.cached 就是您所需要的。我刚刚测试了具有较小缓存时间跨度的示例查询,并且在两种情况下将其设置为 false:(1) 当记录添加时; (2) 发生超时时。所以你的第一个猜测看起来不错。

I believe that result.cached is what you need. I've just tested sample query with small cachedWithin time span and it was set to false in two cases: (1) when records added; (2) when timeout happened. So your first guess looks OK.

情绪 2024-12-20 10:48:24

以防万一有人感兴趣:

由于“缓存”属性在我的情况下并不可靠(可能是因为我从前任那里继承了这个系统,并且无法保证应用程序服务器的修改量)过去)我采用了一种不同的方法,基于经典的cacheGet/cachePut块。

生成的缓存决策逻辑基于此查询提供的后续结构的超时。

Just in case anyone's interested:

Since the "cached" attribute didn't turn out to be reliable in my case (might be because I inherited this system from my predecessor and can't vouch for how much of the application server has been modified in the past) I resorted to a different approach, based on the classic cacheGet/cachePut block.

The resulting caching decision logic is based on the timeout of the subsequent struct that's fed by this query.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文