Data caching is a very important consideration for JEE applications.
A classic problem for any application is to detect and solve the recurrent calls for optimizing the applications. Some cases can be:
- database calls
- business logic calls
- remote method invocations
Data caching limits the number of remote invocations in distributed applications and improves performance of web applications by reducing the number of calls.
Several solutions exist to include a framework for implementing a cache.
Check out this interesting comparative table.
I use whirlycache in two projects and works really good. I recommend it to incorporate in a simple lightweight Web application
Whirlycache is a fast, configurable in-memory object cache for Java. It can be used, for example, to speed up a website or an application by caching objects that would otherwise have to be created by querying a database or by another expensive procedure. From the testing that we have done, it appears to be faster than any other Java cache that we have been able to inspect.
Steps to include WhirlyCache
(Step I) Donwload whirlycache and include it in your project -> https://whirlycache.dev.java.net/files/documents/1995/34601/whirlycache-1.0.1.zip
(Step II) Create a cache instance
CacheConfiguration cc = new CacheConfiguration();
Cache c = CacheManager.getInstance().createCache(cc);
(Step III) Use cache instance
Example of java class (is a jboss seam entity class) – StockCache.java