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
From 1.3.0, J2Cache
supports two ways to notify the cache event, include JGroups
and 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.properties
.
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
Data writing
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.xml
for ehcache 2.xehcache3.xml
for ehcache 3.xj2cache.properties
J2Cache settings, include redis configurations, connection pool, broadcast, serialization etc.network.xml
JGroups network settings, needed when setting j2cache.broadcast = jgroups
Those setting files must be placed in classpath , such as WEB-INF/classes
core/resource/j2cache.properties
to use installed redis serversmvn package -DskipTests=true
runtest.sh
help
to show command list<dependency>
<groupId>net.oschina.j2cache</groupId>
<artifactId>j2cache-core</artifactId>
<version>xxxxx</version>
</dependency>
Refer to J2CacheCmd.java
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Activity
Community
Health
Trend
Influence
:Code submit frequency
:React/respond to issue & PR etc.
:Well-balanced team members and collaboration
:Recent popularity of project
:Star counts, download counts etc.