In one of my assignments, I cam across a scenario where I needed to determine the time a query was cached to give the user an accurate time in which the updated data will be available. I knew the query was caches for 12 hours as the previous developer created a timespan: createTimeSpan(0, 12, 0, 0). That was helpful in knowing how long it would be cached for, but I needed to know when it would re-cache.
Through some thinking, I decided to inject the date into the query itself, and I would be able to determine the re-cache date from that like so:
SELECT Name, Description, CachedOn = getDate()
FROM Material
With this method, I could always reference qryMaterials.CachedOn to determine when the query was cached, and use dateAdd() to figure out that date 12 hours from now. While I believe that was the most effective way to handle this in my situation, I did have to search into it further because it was bothering me that I couldn't get the date from CF. I decided to look around at the CF factories to see if anything there would be helpful... and what do you know! The Java class coldfusion.server.ServiceFactory contained a reference to the coldfusion.server.DataSourceService. From within this service, I was able to access all of the cached queries and get more than just the cache date.
Rather than explain explain the rest with pretty screenshots, I'll let you do the work and see exactly what's available for you. Here is a quick snippet I wrote that displays all of the queries, their names, the cached date, and a link to re-run then query manually. You can also get the ResultSet, change the ResultSet, and a few more methods that I won't discuss here. Hopefully this will be as beneficial to you as it has me.
Cached queries: #arrayLen(arQueries)#
Query: #name# (re-run)
Cached on: #cacheTime#
Jul 10, 2010 at 12:10 PM EPmNA7 vqqijrbugqjw, [url=http://kprtkfbjfoua.com/]kprtkfbjfoua[/url], [link=http://yyanlvfylkrn.com/]yyanlvfylkrn[/link], http://iuncaxvdhxwv.com/
Aug 4, 2010 at 6:40 PM comment6, Viagra, Levaquin, Lexapro, Ambien,
Aug 4, 2010 at 9:40 PM comment6, Adipex, Levaquin, Xanax, Viagra,
Aug 5, 2010 at 12:42 AM comment1, Levitra, Rimonabant,
Aug 5, 2010 at 3:46 AM comment2, Levitra, Prednisone, Levaquin,
Aug 5, 2010 at 6:54 AM comment5, Acomplia, Levitra, Levitra, Viagra,
Aug 5, 2010 at 1:12 PM comment5, Adipex, viagra, Ambien,
Aug 5, 2010 at 4:27 PM comment1, Viagra, Lexapro, Cialis,
Aug 5, 2010 at 7:31 PM comment2, Levitra, Prednisone,
Aug 5, 2010 at 10:36 PM comment5, Cialis, Acomplia,
Aug 6, 2010 at 1:39 AM comment1, Levitra, Prednisone, Ambien,
Aug 14, 2010 at 1:58 PM comment2, Cymbalta, florida accutane lawyer, Phentermine, Valtrex, Levitra, Propecia, Viagra, female viagra, Viagra,
Aug 14, 2010 at 9:35 PM comment4, after bactrim effects, Metformin, Valtrex, cafergot dosing, Clomid, Cialis, Diflucan, Antabuse,
Sep 6, 2010 at 3:35 AM Very nice site! is it yours too
Sep 6, 2010 at 3:35 AM Very nice site! [url=http://yieapxo.com/qoqav/2.html]is it yours too[/url]
Sep 6, 2010 at 3:35 AM Very nice site! is it yours too http://yieapxo.com/qoqav/4.html
Sep 6, 2010 at 3:35 AM Very nice site!
Sep 6, 2010 at 3:35 AM Very nice site! is it yours too , is it yours too , is it yours too , is it yours too , is it yours too , is it yours too , is it yours too , is it yours too , is it yours too , is it yours too ,
Sep 6, 2010 at 3:45 AM Very nice site! is it yours too
Sep 6, 2010 at 3:45 AM Very nice site! [url=http://yieapxo.com/qoqav/2.html]is it yours too[/url]
Sep 6, 2010 at 3:45 AM Very nice site! is it yours too http://yieapxo.com/qoqav/4.html
Sep 6, 2010 at 3:45 AM Very nice site!
Sep 6, 2010 at 3:45 AM Very nice site! is it yours too , is it yours too , is it yours too , is it yours too , is it yours too , is it yours too , is it yours too , is it yours too , is it yours too , is it yours too ,