[Interest] Qt based LRU container?
André Pönitz
andre.poenitz at mathematik.tu-chemnitz.de
Sun Oct 20 13:33:50 CEST 2013
On Sat, Oct 19, 2013 at 09:35:39PM +0200, Mark wrote:
> On Sat, Oct 19, 2013 at 9:20 PM, Richard Moore <rich at kde.org> wrote:
> > On 19 October 2013 18:43, Mark <markg85 at gmail.com> wrote:
> >> Does anyone know of an LRU based container for Qt? I'm specifically
> >> looking for an implementation that notifies me when something gets
> >> removed due to LRU kicking in. QCache would be nearly OK for my needs,
> >> but it doesn't notify me when something drops out due to LRU kicking
> >> in.
> >
> > If you need to know when something is evicted then it's not really
> > acting as just a cache. That said, you could do it by making the
> > object in the cache inform you in its destructor.
> >
> > Rich.
>
> hmm, that could work. Never thought about using the destructor.
> On the other hand, i would get into trouble when the object isn't only
> in the cache but also in other places. Then a destruction signal might
> not necessarily mean that it's removed from the cache.
You could keep a flag in the object that's only set when you
want that behaviour, i.e. which is set when you insert it into
your "cache".
Andre'
More information about the Interest
mailing list