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

1

18

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!

Necolenecro answered 13/12, 2011 at 19:48 Comment(0)
A
31

You can use the following:

<cfobjectcache 
    action = "clear" />

See cfdocs for a full explanation.

Almshouse answered 13/12, 2011 at 20:12 Comment(1)
Awesome! How did I never notice this little tag before? Thanks!Necolenecro

© 2022 - 2024 — McMap. All rights reserved.