Hey,
at first you should gather some information about the topic cache itself.
There is a good explanation at wikipedia (https://en.wikipedia.org/wiki/Cache_(computing)).
I am not familiar with CouchBase. But since it provides key-value based access it sounds like a mix of a cache and a database.
Most java cache implementations are key-value-based. So you can access them like a map.
Here is an example how to access a infispan cache instance (Source: https://docs.jboss.org/author/display/ISPN/Getting+Started+Guide#GettingStartedGuide-5minutetutorial):
38
.
39
. cache.put(
"key"
,
"value"
);
40
.
41
. assertEqual(
1
, cache.size());
42
. assertTrue(cache.containsKey(
"key"
));
43
.
44
. Object v = cache.remove(
"key"
);
45
.
46
. assertEqual(
"value"
, v);
In the past I have also worked with EHCache and JBoss Cache. They are used in a similar way like Infinispan. I have also to mention that there is no "best" cache. You have to evaluate some cache implementations for you project because it depends on a lot of factors like access speed, clustering capabilities, caching algorithms, etc.
For further information you could look up the following websites:
http://www.coderanch.com/how-to/java/CachingStrategies
http://infinispan.blogspot.co.uk/2010/02/infinispan-as-local-cache.html
But do not forget evaluate your desired cache in order to get the best results for your application.
Regards,
Lukas