2
votes

I'm used to Adobe ColdFusion and have been caching queries using cachedafter with a "simple" date:

<cfparam name="application.icons_last_changed" default="#now()#">
<cfquery name="get_icons" cachedafter="02/02/1978" datasource="#application.datasources.main#">
SELECT icon_id, icon_name
FROM REF_Icon
WHERE #application.icons_last_changed#=#application.icons_last_changed#
ORDER BY sort_order
</cfquery>

I transitioned my project from ColdFusion/MSSQL to Railo/PostgreSQL. Today, something in the Railo diagnostics caught my eye.

  • I'm used to seeing "get_ref_icon (Datasource=Workstream, Time=cached, Records=39) in /path/qry_get_ref_icon.cfm"
  • but in Railo I see "get_ref_icon (Datasource=Workstream, Time=0.974 ms, Records=39) in /pathqry_get_ref_icon.cfm".

Thinking that perhaps the simple data value ("02/02/1978") for cachedafter isn't supported by Railo, I tried setting the date with createodbcdatetime('1978-02-02 16:37:00'), but that didn't seem to make a difference.

Of course, 0.974 ms is such a small time that perhaps the query is cached, and Railo just isn't as explicit as ColdFusion.

Is my query getting cached, or am I going about it the wrong way?

1
Does this happen all the time?Dan Bracuk
Yes--lots of data points for this when I compare ColdFusion diagnostics output to Railo diagnostics output.Jeromy French
And it's not a simple case of looking at the diagnostics for the first time the query was run? Also, does Railo show the same de-bugging information that's avaialble on ColdFusion?Dan Bracuk
I'm away from my usual machine @ the mo' (and for the next week), so don't have Railo etc available to test with. But the easiest way to test if you query is being cached is to run it, change the underlying data, then run it again. If you see the same result both runs, it's being cached. If you see the updates you made: not cached. I would expect that it's just Railo's debug output being vague. It might be an idea to ask this question on the Railo Google group, too: groups.google.com/forum/?fromgroups#!forum/railoAdam Cameron
In ACF at least you can see if its cached or not by dumping it or using the result attribute, does that not apply to railo?Busches

1 Answers

3
votes

No, the query is not getting cached.

I followed Busches's suggestion and reviewed the results from <cfdump var="#get_icons#" />:

Query
Template:/super/double/secret/path/qry_get_ref_icon.cfm 
Execution Time (ms):0.624 
Recordcount:39 
Cached:No                                     <--UH OH, SPAGHETTI-O's
Lazy:No 
SQL: 
SELECT icon_id, icon_name 
FROM REF_Icon 
WHERE active_ind=1 /*{ts '1978-02-02 16:37:00'}*/ 
AND {ts '2013-02-20 22:25:14'}={ts '2013-02-20 22:25:14'} 
ORDER BY sort_order 

Because I'm a distrustful type, I also followed Adam Cameron's suggestion and changed some data then reran the query. Query results updated, so no caching.


I've reported the issue to the fine Railo folks: https://issues.jboss.org/browse/RAILO-2318