Question

Initial situation: Inside a function I'm caching a query using the cachedWithin attribute. Right below that cfquery tag I'm caching derived&related data into a struct stored in the SERVER scope.

Problem: I want to re-populate that struct if the query above has been refreshed, but foo.cached only seems to indicate whether the tag uses caching at all. Does Railo provide additional metadata to actually receive true if that query has been updated, not just if it's cached at all or should I resort to a cfcache workaround?

Was it helpful?

Solution 2

Just in case anyone's interested:

Since the "cached" attribute didn't turn out to be reliable in my case (might be because I inherited this system from my predecessor and can't vouch for how much of the application server has been modified in the past) I resorted to a different approach, based on the classic cacheGet/cachePut block.

The resulting caching decision logic is based on the timeout of the subsequent struct that's fed by this query.

OTHER TIPS

I believe that result.cached is what you need. I've just tested sample query with small cachedWithin time span and it was set to false in two cases: (1) when records added; (2) when timeout happened. So your first guess looks OK.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top