tags:

views:

85

answers:

1

Hi,

Can anyone please post sample example to configure Ehcache for standalone java application. I have the simple requirement like, getting data from database, format that data and write to file. I am using jdbctemplate.Query is executing quickly, but retrieving data from list is taking more time. List is holding large volume of data(resultset).

Can anyone suggest me , how to use ehcase to overcome this problem.

Thanks,

Ari

A: 

Check the Code Samples and Recipes chapter for more information on direct interaction with ehcache.

Recipes and Code Samples

The Recipes and Code Samples page contains recipes - short concise examples for specific use cases - and a set of code samples that will help you get started with Ehcache.

They cover several use cases and provide several code samples, which is just what you're asking for.

Pascal Thivent
Hi thanks for your quick reply.I never used cache. I went through the sample code ,but i did not understand how to cache my result list in cache and get from there. Could you please explain more .
ari
thanks for reply. I'm new to ehcache and trying to replicate the sample code. I configured ehcache.xml , and in java method i'm created CacheManager manager = new CacheManager("src/config/ehcache.xml"); manager.addCache("here i'm trying to give resultlist "); but it's expecting string . So how do i cache my resultlist so that i can use it for writing to file. It would be great if you can give any suggestions.
ari
@ari First, I'm really not sure to understand the problem you're trying to solve and if you're on the right path. Anyway, the API you're looking for is `cache.put(new Element("key1", "value1"))` (taken from the samples). You really need to go a bit through the documentation and the samples, they contain everything you need to get started.
Pascal Thivent