schmyrczyk [
https://community.jboss.org/people/schmyrczyk] created the discussion
"Re: Caching in web application"
To view the discussion, visit:
https://community.jboss.org/message/811308#811308
--------------------------------------------------------------
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)
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#GettingS...
https://docs.jboss.org/author/display/ISPN/Getting+Started+Guide#GettingS...):
38. // Add a entry
39. cache.put("key", "value");
40. // Validate the entry is now in the cache
41. assertEqual(1, cache.size());
42. assertTrue(cache.containsKey("key"));
43. // Remove the entry from the cache
44. Object v = cache.remove("key");
45. // Validate the entry is no longer in the cache
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://www.coderanch.com/how-to/java/CachingStrategies
http://infinispan.blogspot.co.uk/2010/02/infinispan-as-local-cache.html
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
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/811308#811308]
Start a new discussion in JBoss Cache at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]