Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommendation for Open Source cache in C++ [closed]

Tags:

c++

caching

I need a caching library in C++ that acts a bit like Guave's Loading Cache.

It should include the following:

  • non-blocking access
  • time based eviction
  • size based eviction

I have looked at the STL, Boost and searched around but I am unable to find anything with this functionality.

like image 753
user1610694 Avatar asked Feb 10 '13 12:02

user1610694


1 Answers

Check out POCO. I believe its caching framework will suit your needs.

ExpireLRUCache<int, string> cache(
                              1024,  // cacheSize
                              600000 // expiration (10 minutes)
);

cache.add( 1, "Cached string 1" );
cache.add( 10, "Cached string 10" );

Sleep( 601000 );

Shared_ptr<string> pVal = cache.get( 10 );
assert( pVal.isNull() ); // the element has expired
like image 151
Alex Avatar answered Oct 19 '22 12:10

Alex