danieln
danieln

Reputation: 4973

Concurrent Cache in Java

Suppose I have multiple threads accessing a map (actions are: inserting, retrieving, removing), and I'm using ConcurrentHashMap, do I need to do anything else or does ConcurrentHashMap 'covers' me?
Is there still something 'bad' that can happen?

Upvotes: 0

Views: 218

Answers (2)

Andremoniy
Andremoniy

Reputation: 34900

Because we do not know all scenarios of your task, according to what you have described, imho ConcurrentHashMap is sufficient.

Upvotes: 1

Eugene
Eugene

Reputation: 120848

You could also look into guava cache. Sounds very suited for your scenario.

Link

Upvotes: 1

Related Questions