cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Max Pfingsthorn" <>
Subject RE: caching for source objects?
Date Wed, 25 Jan 2006 10:46:09 GMT
> -----Original Message-----
> From: Jean-Baptiste Quenot []
> Sent: Tuesday, January 24, 2006 18:40
> To:
> Subject: Re: caching for source objects?
> * Carsten Ziegeler:
> > Max Pfingsthorn schrieb:
> >
> > > I've run into some problems  with performance (in general) and
> > > I noticed that source objects are not cached... This is not so
> > > nice since, for example,  WebDAVSources are quite expensive to
> > > instantiate.
> >
> > I  think  we  have   a  CachingSource  implementation  somewhere
> > (scratchpad?) which  can be used  as a wrapper around  any other
> > source implementation. I think this one will fit your use case.
> CachingSource builds a new Source  object every time, that costs a
> lot for SitemapSource.   I'm currently looking for a  way to cache
> the Source objects (that could  be configurable with a new request
> parameter), not only the cached response.
> The  problem is  that  I don't  want  to  end up  with  a lots  of
> unreleased sources.  The  best would be to  release sources unused
> for a certain period of time.  Is that possible?

Releasing sources is not really a problem. When you get the source from the cache (be it either
the serialized one from the Cache or the object itself from the Store), you can ask it for
the validity and check it. If it's not valid, release it and make a new one, otherwise use
the one you got.
There might be a problem with EventCaching this way, since the eventaware code doesn't know
about releasing sources (yet). I made an EventAware MRUMemoryStore recently (not sure if I
committed it..), so its method to process event caching events can be adjusted to check if
the object to be removed is a source and release it first. I'm not sure, but I also think
its possible to overload the remove() method of the MRUMemoryStore instead and also catch
other evictions.


View raw message