It uses DeltaTimeCacheValidity which accepts a time value in its
constructor:

http://xml.apache.org/cocoon/apidocs/org/apache/cocoon/caching/DeltaTimeCacheValidity.html

   The CacheableSource creates one of these in its constructor,  and
CacheableSourceFactory keeps a java.util.Map associating urls with
CacheValiditys that are in the cache.  The two are compared to decide
whether or not to refresh the cache as well as what to return for
getLastModified().  At the moment the time value is hard coded
(I'm using 15 minutes).
    I did consider using a Generator to do this, and to be honest, I've
forgotten why I abandoned that effort.

Charles

Reinhard Pötz wrote:

Charles,

Nice to hear this!

One question: How do you set the cache validity time e.g. 60 minutes if
you use a source?

Regards,
Reinhard



-----Original Message-----
From: Charles Yates [mailto:[EMAIL PROTECTED] Sent: Thursday, February 27, 2003 2:56 PM
To: [EMAIL PROTECTED]
Subject: Re: caching



I am curently testing a 'CacheableSource' and 'CacheableSourceFactory' that does these things. Its not ready for prime time yet but it does do the things mentioned here. Used like this:


cache://http://www.unreliableserver.com/news.rdf
cache://cocoon://resource/that/takes/a/long/time

It uses DeltaTimeCacheValidity. If the validity has expired, it returns the resouce from the cache and updates it in another thread.

I'll report back when its ready.


Charles


Carsten Ziegeler wrote:







-----Original Message-----
From: Reinhard Pötz [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 27, 2003 12:39 PM
To: [EMAIL PROTECTED]
Subject: RE: caching






From: Carsten Ziegeler [mailto:[EMAIL PROTECTED] Reinhard Pötz wrote:




Do you know whether there is some mechanism to get the old




(=expired)




content if the external source is not available after it




expired?




No, it's not possible.




At which 'level' would you solve that problem? Would you write a special generator?





Yes, exactly.

But I'm not sure if this is a good solution. If the

external source

is not available, you usually get a timeout (4 or 5 minutes?). So, you have to wait for this timeout and then serve from the

cache; this

time is too long for the casual user.

I would suggest that you always serve from the cache even if the content has expired. If it has expired you will the cache in the background. This can be done in a special generator as well.




Am I right you would write a background component that tries to refresh all expired content of the cache and until it is

updated the

'old' version could be used.




Yes.





Would this fit in the already existing "pipeline-expires" and "pipeline-caching" concepts?





This would be two different parts, so the
caching algorithm works as always and your generator does


his work. Of

course, your generator can be still cacheable and used by

the caching

pipeline.

Carsten


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]







--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to