ps34
ps34

Reputation: 183

Caching in Java with Singleton Pattern

I want to send some file(s) to cache and read them from cache in Java. I've been searching for this on the internet but there are many advanced stuff for caching. I've downloaded ehcache but couldn't find a way to work things out. Is there a library for just caching and reading files from cache in java? I'm kinda new in Java, therfore I don't understand advanced stuff easily.

Thank you for your help.

Upvotes: 1

Views: 7846

Answers (3)

shatk
shatk

Reputation: 485

You can have a look at Cacheonix. Cacheonix is an open source distributed data management framework for Java. For more details on File Caching , read

http://www.cacheonix.com/articles/How_to_Cache_a_File_in_Java.htm

Upvotes: 0

Rakesh KR
Rakesh KR

Reputation: 6527

Ehcache is also a good one.
Try this

Upvotes: 0

Vinay Lodha
Vinay Lodha

Reputation: 2223

Google Guava provide simple way to implement cache in your application.

LoadingCache<Key, Graph> graphs = CacheBuilder.newBuilder()
       .maximumSize(1000)
       .expireAfterWrite(10, TimeUnit.MINUTES)
       .removalListener(MY_LISTENER)
       .build(
           new CacheLoader<Key, Graph>() {
             public Graph load(Key key) throws AnyException {
               return createExpensiveGraph(key);
             }
           });

Hope this helps

Upvotes: 2

Related Questions