I have a question on how to use the redis object cache.
I recently switched from internal caching in Lucee and added the Redis Extension. I also have enabled the object cache.
I want to use the cache to display certain items and to deliver it fast, it should come out of the cache.
From time to time I need to refresh it, so I introduced a URL param flushCache=1.
If I detect it, I want to empty the cache, but as this is during the request, the cache should be populated again, as the code needs to be executed.
So, here’s my code:
<cfif isDefined("url.flushCache") && url.flushCache eq "1"> <cfcache action="flush" key="#cacheName#" /> </cfif> <cfcache action="cache" timespan="#defaultCachingTime#" key="#cacheName#"> <!--- do stuff that should be then stored into the cache ---> </cfcache>
Unfortunately, the page request, when I do it will be super fast, as it seems that Lucee will still give me the content from the cache, and flush it afterwards.
Next time I hit the page (even without the URL param), cache is empty and processing takes very long.
What am I doing wrong?