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
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). https://github.com/lucee/Lucee/blob/master/test/tickets/LDEV0907.cfc#L41-L54
or , can we mark this bug as something other than DEPLOYED, or do we need to create a new issue?
similar issue on <cfcache> tag:
<cfcache timespan="#createtimespan(0,0,0,0)#"> does not clear the cfcache copy
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.
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:
Output:
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
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.