JCS (Apache) has a really nice API and architecture, but the memory overhead looks disgusting, and I'm not convinced that anybody uses it. If it wasn't for those two issues, I'd use it.
EhCache is not bad. The API methods never _quite_ do what one wants, for example, it implements Map, but it's not Map<Key,Value>, it's Map<Key,Element<Value>>, and it's written without generics. Also, cache.setCacheLoader(...) does not cause the cache loader to be used on future get() calls. For all of this, it's relatively easy to bend the API to do what I want.
JSR107 could be worse. EhCache is tied quite closely to it. There is a JSR107 project on sourceforge, but nobody seems to "own" it and google doesn't see it.
I'm not using OSCache or SwarmCache, since they seem to target specific application domains which do not include my application. They may also be good general purpose caches, I don't know.
On the whole, the situation could be worse.
I would like:
- Use of generics, including in CacheLoader.
- Use of CacheLoader in get() calls.
- Some sort of CacheLoaderAdapter provided by standard.
- Different semantics for Map.get() and Cache.getElement() calls.