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