Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-03-11 12:45:56


----- Original Message -----
From: "Rainer Deyke" <root_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, March 11, 2002 12:33 PM
Subject: Re: [boost] Interest in a cache class?

> ----- Original Message -----
> From: "David Abrahams" <david.abrahams_at_[hidden]>
>
>
> > ----- Original Message -----
> > From: "Rainer Deyke" <root_at_[hidden]>
> >
> > > > > However, having lots of shared_ptrs
> > > > > keeping the cached objects alive defeats the purpose of the
> cache.
> > > >
> > > > Maybe your purpose. When I've needed a cache, I've needed some
> way
> > > to
> > > > prevent certain objects from being flushed.
> > >
> > > Why?
> >
> > Because the objects were "currently in use" - essentially because
> they
> > were likely to be needed again soon,
>
> I remain unconvinced. There is no semantic difference between keeping
> the same object around and discarding it and reloading on demand.
> There is a difference in performance, but the cache itself is probably
> in a better position to judge when objects should be discarded than
> the user.

It seems a bit perverse to design a cache around the idea that the user
doesn't understand her performance needs as well as the cache designer.
Once I'm using a cache, I'm already in the domain where I want control
over low-level details that affect performance. If I didn't care about
that, I'd just recompute the data each time I needed it.

-Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk