I have a page with a query that will rarely change. The output will pretty much always be the same, so I'd like to take advantage of caching. Problem is, if there is a chance, it needs to change right now, right this very second. Is there a way that I can set the cached within to be indefinite, but then invalidate that cache and force recalculation when required?
Should I just run the query once then store it in the application scope and only refresh when it gets updated?
The way I have done this is to use a variable with a dynamic value for the cachedWithin or cachedAfter parameter. Under normal conditions this variable is set to a value that will have ColdFusion use the cached query, But when you want to refersh it, you change the variable value to something that will expire the cached query.