J2Cache is a two-level cache framework for Java. The first level cache uses the memory cache framework and the second level cache uses Redis. Since a large number of cache reads cause the L2 network to become a bottleneck to the entire system, the goal of L1 is to reduce the number of reads to L2. This cache framework is mainly used in a clustered environment. Stand-alone can also be used to avoid memory data loss due to application restart.
We also provided Python version, Please refer to https://gitee.com/ld/Py3Cache
J2Cache supports two ways to notify the cache event, include
Redis PubSub. In cloud platforms may not be able to use JGroups's multicast mode, so you can choose
Redis PubSub. For more details, please see configuration file description in
J2Cache two-level cache system architecture
L1： In-Process Memory Cache Framework(ehcache,caffeine)
L2： Redis Server
Since a large amount of cache reads causes network bandwidth to become a bottleneck in the overall system, the goal of L1 is to reduce the number of L2 reads
Data reading -> L1 -> L2 -> DB
1 Read latest data from the business system, updates L1 -> L2, and then broadcast clear event to all nodes in cluster 2 When received the clear event, clear corresponding data in memory
settings file located in
core/resources directory, include:
ehcache.xmlfor ehcache 2.x
ehcache3.xmlfor ehcache 3.x
j2cache.propertiesJ2Cache settings, include redis configurations, connection pool, broadcast, serialization etc.
network.xmlJGroups network settings, needed when setting
j2cache.broadcast = jgroups
Those setting files must be placed in classpath , such as
core/resource/j2cache.propertiesto use installed redis servers
mvn package -DskipTests=true
helpto show command list
<dependency> <groupId>net.oschina.j2cache</groupId> <artifactId>j2cache-core</artifactId> <version>xxxxx</version> </dependency>
Refer to J2CacheCmd.java
：Code submit frequency
：React/respond to issue & PR etc.
：Well-balanced team members and collaboration
：Recent popularity of project
：Star counts, download counts etc.