Hi Alan,

I think you misunderstood me. I don't think CACHEDAFTER should work as 
"Don't cache until a date in the future", and I didn't mean to describe 
such a functionality.

Simple example:

<cfquery name="foo" cachedafter="#updated#">
 ...
</cfquery>

updated is a timestamp of the time changes were last made to tables 
relating to query foo.

If CACHEDAFTER worked as I think it should, the query would stay in cache 
for as long as updated stays the same and now()>updated.

When cachedafter value is used as a part of the cache key, updating it's 
value would also invalidate the old cache item.

Obviously the same functionality can be accomplished the way we're doing it 
now:

<cfquery name="foo" cachedwithin="#CreateTimeSpan(100, 0, 0, 0)#">
 ...
 AND #Hash(updated)# = #Hash(updated)#
</cfquery>

I guess the original intention for CACHEDAFTER is to use "live" data from 
the DB at certain times, while serving cached content at others. For 
instance on an auction site you might want to query bids using 
CACHEDAFTER="#auctionCloseTime#".

 Jari

On Tuesday, October 9, 2012 2:39:09 PM UTC+3, Alan Williamson wrote:
>
>  i seen your bug report ... i didn't get a chance to respond to it.
>
> I believe this to be one of the quirks of CFML documentation, because the 
> situation you are describing i can't actually think when i would want to 
> use that.   it doesn't seem to make sense.   Don't cache until a date in 
> the future?
>
> I believe the CACHEDAFTER was poorly named, and really should have been 
> called CACHEDUNTIL
>
> On 07/10/2012 08:28, Jari Ketola wrote:
>  
> CFQUERY's CACHEDAFTER should cache queries run after specified time. For 
> instance queries set with CACHEDAFTER timestamp {ts '2012-10-05 07:00:00'} 
> should be served from cache indefinitely after that time. When the 
> CACHEDAFTER is updated, the old cache item should be discarded and new used.
>
> Currently cfQUERY.java:277 defines:
>
> expireTime     = getDynamic(_Session, "CACHEDAFTER").getLong() - 
>> System.currentTimeMillis();
>>
>
> Submitted this as issue 
> 493<http://code.google.com/p/openbluedragon/issues/detail?id=493>as I believe 
> this is incorrect. This implements a "cached until" 
> functionality. "Cached after" should compare CACHEDAFTER to now(), and if 
> now()>CACHEDAFTER, use a cache with a key derived from CACHEDAFTER. That 
> way the cache is valid as long as the CACHEDAFTER stays the same.
>
> Or am I missing something?
>
>   Jari
>
> -- 
> online documentation: http://openbd.org/manual/
> http://groups.google.com/group/openbd?hl=en
>
>
>  

-- 
online documentation: http://openbd.org/manual/
 http://groups.google.com/group/openbd?hl=en

Reply via email to