[Interest] Qt based LRU container?

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Sun Oct 20 13:28:23 CEST 2013


I wrote a ordered map sometime back using a QHash and QLinkedList.

https://github.com/mandeepsandhu/qt-ordered-map

In the 'examples' section, I've implemented a simple LRU cache using
the ordered map.
https://github.com/mandeepsandhu/qt-ordered-map/tree/master/examples/lrucache

Once the capacity of the cache is reached and a new item is inserted,
we take the first element of the ordered map, which is the least
recently used item, and remove it.

You could easily modify this code to emit a signal when this eviction happens.

HTH,
-mandeep


On Sat, Oct 19, 2013 at 11:13 PM, Mark <markg85 at gmail.com> wrote:
> Hi,
>
> 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.
>
> I prefer if the container itself is a list though a map/hash would
> work for me as well.
>
> Cheers,
> Mark
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list