Least Recently Used (LRU) Cache is to discard the least recently used items first How do you design and implement such a cache class? The design requirements are as follows:
I have a LRU implementation here. The interface follows std::map so it should not be that hard to use. Additionally you can provide a custom backup handler, that is used if data is invalidated in the cache.
sweet::Cache, 48> c1;
c1.insert("key1", std::vector());
c1.insert("key2", std::vector());
assert(c1.contains("key1"));