2-level cache in java

guys How can I organize level 2 cache in java? 1st level - memory 2nd level - file system

Where can I find information about level-2 cache configuration and cache configuration, or can you show me any methods that can solve this problem.

thank

+3
source share
5 answers

I suggest using imcache and loading the necessary elements from disk using the cache loader as follows:

Cache<String,Object> yourCache = CacheBuilder.
   concurrentHeapCache().cacheLoader(new CacheLoader<String, Object>() {
   public Object load(String key) {
   //code to load item from file.
   }
}).build();  
+2
source

It seems that using option 2 with the option to overwrite to disk will work for the OP. These 2 URLs can help: http://memcached.org/ and http://ehcache.org/

+1

, , , . http://www.javalobby.org/java/forums/t48846.html

, java, 1.) HashMap 2.) Memcached 3.) 4.)

, , .

0

OS Cache - http://www.opensymphony.com/oscache/wiki/Feature%20List.html .

  • - .

  • It transparently stores the most used data in memory and then swaps the rest into the file system (you can change the algorithm)

  • It scales well. Even for a large number of objects, it does not show a decrease in performance.

  • It also supports clustering.

  • He is very customizable

  • It is FREE and open source!

0
source

I created something that can be useful for your needs.

https://github.com/enryold/onion-cache

0
source

Source: https://habr.com/ru/post/1787942/


All Articles