Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I clear the coldfusion query cache without restarting the server?

I have several queries that I cache using the cachedwithin="#CreateTimespan(...)#" attribute of the cfquery tag. There are times when I need to clear the cache (or just re-execute the query to get a new cached copy). Historically, I've done one of two things to accomplish this -

  1. Restart the coldfusion service.
  2. Slightly alter the query in the code, say by adding or deleting whitespace.

Neither of these options are very good, especially when in production. I'm not asking for how I might expire the cache programmatically (although, that would be nice!), but more simply - how can I clear the cached queries on the server without having to resort to one of those two above methods? I'd be happy to hear about methods that work either server-wide, or application-wide, or even how to expire a specific cached query. Thanks!

like image 681
Jake Feasel Avatar asked Dec 13 '11 19:12

Jake Feasel


People also ask

How to clear ColdFusion cache?

To clear cache in ColdFusion visit server settings section and click on clear template cache now to clear template cache or choose the clear folder specific template cache button to clear the cache from individual folders.

How do I remove query cache?

If you want to disable the query cache code, set query_cache_size=0. By disabling the query cache code there is no noticeable overhead. (query cache can be excluded from code with help of configure option --without-query-cache)

How do you cache a query?

To cache a query, go ahead and save the query first. Fig 1: Press the button to "Save" the query. Then, to cache your most important queries select the “Enable Caching” checkbox and enter a refresh rate.

Is ColdFusion a query?

Gets metadata (such as the methods, properties, and parameters of a component) associated with an object that is deployed on the ColdFusion server. Determines whether a value is a query. contents of a one-dimensional array.


1 Answers

You can use the following:

<cfobjectcache 
    action = "clear" />

See cfdocs for a full explanation.

like image 158
Barry Jordan Avatar answered Oct 05 '22 23:10

Barry Jordan