1 Reply Latest reply on Mar 17, 2010 8:31 AM by ilssac

    Query - Remain cached until invalidated

    kenji776 Level 1

      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?

        • 1. Re: Query - Remain cached until invalidated
          ilssac Level 5

          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.