• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Query - Remain cached until invalidated

Guest
Mar 17, 2010 Mar 17, 2010

Copy link to clipboard

Copied

Hey all,

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?

TOPICS
Advanced techniques

Views

272

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 17, 2010 Mar 17, 2010

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation