How can I clear a cached query in ColdFusion?

Here are methods that you can use in your ColdFusion code to clear a cached query:

To refresh a specific query, run the query again with a CreateTimeSpan value of (0, 0, 0, 0). Here is an example of a query with the cachedwithin attribute:

<cfquery datasource="myDSN" name="myQuery" cachedwithin="#CreateTimeSpan(0, 0, 0, 0)#">
SELECT *
FROM mytable;
</cfquery>


Alternatively, to clear all queries from the server's cache, use this:

<cfobjectcache action="CLEAR">

Add Feedback