[Erp5-dev] caching per object

Jérôme Perrin jerome at nexedi.com
Fri Sep 15 09:12:37 CEST 2006


Le Jeudi 14 Septembre 2006 23:28, Bartek Gorny a écrit :
> On 15/09/06, Jerome Perrin <jerome at nexedi.com> wrote:
> > On Thu, Sep 14, 2006 at 09:04:29PM +0200, Bartek Gorny wrote:
> > > Hello
> > >
> > > I tried to use caching methods, but it seems that a simple statement
> > > like:
> > >
> > >  def getWhatever(self):
> > >    def cached_getWhatever():
> > >      return something
> > >   cached_getWhatever=CachingMethod(cached_getWhatever, id='an_id')
> > >   return cached_getWhatever()
> > >
> > > does caching per portal type, which is very useful, but I need to do
> > > caching per object - is there any way to do this?
> >
> > This is actually does "global" caching. Cache keys are parameters you
> > pass when calling the (wrapped) method.
>
> Ah, got it - that's why I thought it caches per type - in my case the
> wrapped method got an argument which was different for every portal
> type.
>
> BTW, is this cache system-wide, or bound to a site or user session?

System-wide, but you can for example pass the user name as a parameter to make 
it per user.

-- 
Jérome



More information about the Erp5-dev mailing list