> -----Original Message-----
> From: Carsten Ziegeler [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 09, 2002 7:56 AM
> To: Cocoon-Dev
> Subject: RE: Cachable Readers
> 
> 
> 
> Amir Rosen wrote:
> > 
> > > -----Original Message-----
> > > From: Carsten Ziegeler [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, August 07, 2002 10:53 AM
> > > To: [EMAIL PROTECTED]
> > > 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.

Ok, what i'm saying is that if the cached version is used, then the methods
getLastModified() & getMimeType() should be invoked on the cached object too,
thus they shouldn't be called before generateValidity().



> 
> 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: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
> 
> 

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

Reply via email to