Why & How |
---|
WHY ?This is a powerful yet simple LRUCachingMap implementation.Short defintion: Caches key/values for a certain amount of time, when ever a key is "get" the expiration time can be extended. It is all POJO classes, so no external setup of configuration files, facets, metadata properties etc. It makes heavy use of generics and is therefore highly extendable. It supports persistences of your cache. And it can comes with the 1 default implementation and 6 versitale versions of that
HOW ?First choose the type of your Key and Value.Than choose if your want cache the value in memory or it has to be persisted. There is a LRUCachingMapFactory which is extremely useful, but as you will see in the library it is very easy to customize. To get you going - if you write this. DefaultLRUCachingMap<Long,String> cache =LRUCachingMapFactory.createMemoryCache(DefaultLRUCachingMapConfiguration.ONE_DAY());You will have a "memory" cache where:
|