Caching - Memory

The basics

If your want to cache key values in memory this is how you do it.

LRUCachingMap<K,V> map = new DefaultLRUCachingMap<K,V>();
Actual instance would be
LRUCachingMap<Long,String> map = new DefaultLRUCachingMap<Long,String>();
or
LRUCachingMap<String,Book> map = new DefaultLRUCachingMap<String,Book>();

But this actually this instance of:
LRUCachingMap<String,Book> map = new DefaultLRUCachingMap<String,Book>(new DefaultLRUCachingMapConfiguration(),new DefaultMemoryValueManager<String,Book>);

LRUCachingMapFactory

There is also a factory class to all this -
LRUCachingMapFactory
.

So the code above can in reality be done like.
DefaultLRUCachingMap<String,String> cache =LRUCachingMapFactory.createMemoryCache(new DefaultLRUCachingMapConfiguration());