Is there a way for me to check a query result to s...
# cfml-general
r
Is there a way for me to check a query result to see if it was cached?
If you dump a query, the header of the dump will show the sql that was executed, the execution time, and other stuff, like whether or not the query was cached. How can I access that info?
r
Save the query's result to a variable and then check the result's cached key.
Copy code
qryData = queryExecute( "SELECT * FROM SomeTable", {}, { result: "qryResult" } );
writeOutput( qryResult.cached );
👍 1
🏆 1
r
hot damn! Thank you!
👍🏻 1
I've only used the result option to get IDs after inserts... didn't know I could also get the query info
r
It's also useful for debugging since it will return the actual SQL executed after parameter substitutions.
👍🏼 1
👍 1
r
yea, that's great... usually I just copy the sql from the dump header, but this is useful for sure