Coldfusion 可以使用 Java 方法/对象来获得更好的 cfquery 性能吗?

发布于 2024-08-15 05:12:03 字数 429 浏览 11 评论 0原文

我想知道是否有 java 方法/对象可以替代 cfquery,它们都允许变量卫生和更好的缓存方法。

我知道您可以使用信息模式来获取数据类型和字符长度,然后使用它来验证数据类型和字符长度。查询中变量的长度。

但随着每个人都转向使用 cfqueryparam 进行绑定变量和变量清理,这也阻止了在 cfquery 上使用缓存。

所以我希望有更好的方法或脚本来获得更高的性能和可扩展性...

就我个人而言,我认为我们需要一种新的方式或方法在 cfquery 中进行缓存。因为我们真正想要的不是缓存 x 分钟,而是缓存直到数据发生变化,使用新鲜数据,然后再次缓存回来,直到数据再次发生变化。

相反,多年来,我们不得不计算我们想要在 Coldfusion 中缓存 cfquery 多长时间,这并不能提供很多控制或了解数据何时更改或未更改的信息。

这有意义吗?

I am wondering if there are java methods/objects that would be alternatives to cfquery, that both allow variable sanitation, and better caching methods.

I know that you can use information schema to get data types and char lengths, and then use that to validate data type & length of variables in a query.

But with everyone converting to using cfqueryparam for bind variables and variable sanitation, that also prevents using caching on a cfquery.

So I was hoping there was better ways or scripts to get more performance and scalability...

Personally, I think we need a new way or method of caching in cfquery. Because what we really want isn't to cache for x number of minutes, but to cache until the data changes, use fresh data, then cache back again, until the data changes again..

Instead for years, we've had to calculate how long we want to cache a cfquery in coldfusion, which doesn't give a lot of control or awareness of when the data was changed or not..

Does this make sense?

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

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

发布评论

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

评论(3

诗酒趁年少 2024-08-22 05:12:03

首先,我们要消除一个误解。在 CF8+ 上,您可以缓存使用 cfqueryparam 的查询。我也不太确定“每个人都进行转换”是什么意思,因为使用它已经被广泛认为是最佳实践一段时间了。

所以,我认为你的问题实际上没有实际意义。虽然您可以手动缓存查询(我对其他数据类型也这样做),但 cfqueryparam 已经有一段时间没有成为这样做的理由了。

First, let's eliminate a misconception. On CF8+, you can cache queries that use cfqueryparam. I'm not really sure what you mean by "everyone converting," either, since using it has been widely considered a best practice for a while.

So, I think your question is actually moot. While you can cache queries manually (and I do this for other datatypes) cfqueryparam hasn't been a reason to do this in a while.

赤濁 2024-08-22 05:12:03

如果您正在寻找访问数据的“替代”方法,ORM(对象关系映射)就是您的最佳选择。如果您使用 CF9,则在底层使用 Hibernate 库 (Java) 来管理数据的访问和缓存。

CF7+ 用户可以使用 Mark Mandel 为 ORM 功能构建的 Transfer 库。

If you are looking for an "alternative" method of accessing data, ORM (Object Relation Mapping) is the way to go. If you are using CF9, the Hibernate library (Java) is used under the hood to manage the access and caching of data.

CF7+ users can use the Transfer library which was built by Mark Mandel for ORM capabilities.

那支青花 2024-08-22 05:12:03

除了 jarofclay 的回答之外,我还想指出 Transfer ORM 具有内置缓存系统(尽管即将推出的版本将允许使用一些更好的现有解决方案),这就是它提供更好的效果的方式表现。

无论如何,我最好从模式和查询优化开始,并尝试使用缓存,它可以在真正不同的级别上完成:从数据库查询到呈现的内容。

例如,新版本的 Railo 支持一些企业级缓存引擎,如 ehCache。

在我看来,这是解决性能任务的更好方法,而不是尝试搞乱 Java 和查询。如果我理解正确,它们仍然会通过相同的数据源运行,甚至可能使用相同的底层字节码。

In addition to jarofclay's answer I'd like to note that Transfer ORM has built-in caching system (though coming version will allow to use some even better existing solutions), this is how it delivers better performance.

Any way, I'd better started with schema and queries optimization plus tried to use caching, it can be done on really different levels: from db queries up to the rendered content.

For example, new version of Railo supports some enterprise-level caching engines like ehCache.

IMO this is better way to solve your performance task than trying to mess with Java and queries. If I understand things correctly, they still will be running through the same datasources, maybe even with same underlying byte-code.

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