答案 0 :(得分:5)
结帐POCO。我相信它的caching framework将满足您的需求。
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