"threadlocal hashmap vs concurrenthashmap for thread-safe unbound caches" Code Answer
1
use threadlocal as cache is a not good practice
in most containers, threads are reused via thread pools and thus are never gc. this would lead something wired
use concurrenthashmap you have to manage it in order to prevent mem leak
if you insist, i suggest using week or soft ref and evict after rich maxsize
if you are finding a in mem cache solution ( do not reinventing the wheel )
try guava cache
http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/cache/cachebuilder.html
use threadlocal as cache is a not good practice
in most containers, threads are reused via thread pools and thus are never gc. this would lead something wired
use concurrenthashmap you have to manage it in order to prevent mem leak
if you insist, i suggest using week or soft ref and evict after rich maxsize
if you are finding a in mem cache solution ( do not reinventing the wheel ) try guava cache http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/cache/cachebuilder.html