Search code examples
coldfusioncfquery

Can Coldfusion use Java methods/objects to get better cfquery performance?


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?


Solution

  • 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.