cachedwithin with an timespan of zero no longer clears cache


On Lucee 4.5, <cfquery cachedwithin="#createTimeSpan(0,0,0,0)#"> would run the query without caching, effectively clearing the cache for that query. In Lucee 5, cached results are returned. This breaks my standard cache-busting strategy in my legacy code.

Workaround: don't use cachedwithin.


Ubuntu 12.04, 16.04


Leon Miller-Out
October 11, 2017, 3:35 PM

I'm sorry to say this, but this bug is only partially fixed. The fixed part is that a query with cachedWithin=0 now skips the cache. The part that is still broken is that cachedWithin=0 does not clear the cached results for that query. So, cache invalidation of a particular query is still impossible.

I believe that the tests I wrote for this problem are not being executed as part of the test suite (due to the function having been renamed test2).

or , can we mark this bug as something other than DEPLOYED, or do we need to create a new issue?

aaron lim
October 21, 2017, 4:25 AM

similar issue on <cfcache> tag:

<cfcache timespan="#createtimespan(0,0,0,0)#"> does not clear the cfcache copy

Leon Miller-Out
November 15, 2017, 5:24 PM

For anyone who is still interested in seeing a complete fix for this issue, please check out issue 1586, which I have filed to address the remaining problem with cachedwithin.

Leon Miller-Out
November 15, 2017, 6:46 PM

I'm happy to report that I've done some more testing, and I think my previous assessment was incorrect and that the fix is addressing my issue. Sorry for the drama!

Test code:


Was populateCache cached? false
Was readCache cached? true
Was invalidateCache cached? false
Was readNewCache cached? true
populateCache should find 0 rows. It found 0
readCache should find 0 rows. It found 0
invalidateCache should find 2 rows. It found 2
readNewCache should find 2 rows. It found 2

Patrick Quinn
November 16, 2017, 11:42 PM

Thanks for the update, , and for all that testing effort as well. Very helpful to Lucee to have that kind of thorough testing help from our users. Glad to hear it's working for you.



Igal Sapir


Leon Miller-Out





Fix versions



Affects versions