cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject RE: Cachable Readers
Date Fri, 09 Aug 2002 05:55:39 GMT

Amir Rosen wrote:
> 
> > -----Original Message-----
> > From: Carsten Ziegeler [mailto:cziegeler@s-und-n.de]
> > Sent: Wednesday, August 07, 2002 10:53 AM
> > To: cocoon-dev@xml.apache.org
> > Subject: RE: Cachable Readers
> > 
> > Amir Rosen wrote:
> > > 
> > > I'm using cocoon 2.0.3.
> > > I'm writing a class extending AbstractReader, and 
> > implementing Cacheable.
> > > When a Reader is used, the order the methods are called is:
> > > getMimeType()
> > > getLastModified()
> > > generateValidity()
> > > 
> > > Thus, getLastModified() & generateValidity() are called on the 
> > > new reader created, and not on the "right" reader that is known
> > > only after the validity check.
> > > 
> > > I hope i explained myself better this time.
> > > 
> > Ok, now I got the first part, the order of the methods called, but 
> > what do you mean by "right" reader?
> > 
> > Usually, when the first method is called (= getMimeType() ) the
> > reader should collect all necessary information (mime type, 
> > last modified,
> > validity etc.) and return only the mime type. When then the next
> > method is called (= getLastModified() ), the previous collected
> > information is returned etc.
> > 
> > Does this make sense?
> > 
> > Carsten 
> > 
> 
> By the "right" reader I mean the new reader or the cached reader,
> choosen by the validity check.
Sorry, I still don't get this. The reader is an Avalon component
and there is excactly one per request.
If you have a <map:read src="uri" type="xyz"/>, then one reader
of the given type is instantiated and the methods are called
on this one reader instance in the order you mention above.

If you have a look at the ResourceReader you can see how it 
works - this one component checks on each invokation if the
requested source has changed. If so, the new source is served
and if not a cached version is used.

HTH
Carsten

> For performance reasons, I wouldn't want my new reader to collect
> any unnecessary data, unless it is going to be used, which should 
> be check by the CacheValidity object.
> Anyway, getLastModified() & getMimeType(), should be called on the
> cached reader and not the new reader, if it's generate() is going
> to be called.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message