1 Star 0 Fork 54

yangmain / layering-cache

forked from xiaolyuh / layering-cache 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

layering-cache

简介

Maven Central License

layering-cache是在Spring Cache基础上扩展而来的一个缓存框架,主要目的是在使用注解的时候支持配置过期时间。layering-cache其实是一个两级缓存,一级缓存使用Caffeine作为本地缓存,二级缓存使用redis作为集中式缓存。并且基于redis的Pub/Sub做缓存的删除,所以它是一个适用于分布式环境下的一个缓存系统。

支持

  • 支持缓存监控统计
  • 支持缓存过期时间在注解上直接配置
  • 支持二级缓存的自动刷新(当缓存命中并发现缓存将要过期时会开启一个异步线程刷新缓存)
  • 刷新缓存分为强刷新和软刷新,强刷新直接调用缓存方法,软刷新直接改缓存的时间
  • 缓存Key支持SpEL表达式
  • 新增FastJsonRedisSerializer,KryoRedisSerializer序列化,重写String序列化。
  • 支持同一个缓存名称设置不同的过期时间
  • 输出INFO级别的监控统计日志
  • 二级缓存是否允许缓存NULL值支持配置
  • 二级缓存空值允许配置时间倍率

文档

中文文档

打开监控统计功能

打开监控统计功能

打开内置的监控页面

打开内置的监控页面

重要提示

  • layering-cache支持同一个缓存名称设置不同的过期时间,但是一定要保证key唯一,否则会出现缓存过期时间错乱的情况
  • 删除缓存的时候会将同一个缓存名称的不同的过期时间的缓存都删掉
  • 在集成layering-cache之前还需要添加以下的依赖,主要是为了减少jar包冲突(依赖jar列表)。
  • redis的key序列化方式必须StringRedisSerializer

更新日志

更新日志

实现原理

实现原理

作者信息

作者博客:https://www.jianshu.com/u/4e6e80b98daa

作者邮箱: xiaolyuh@163.com

github 地址:https://github.com/wyh-chenfeng/layering-cache

捐赠

项目的发展离不开你的支持,请作者喝杯咖啡吧!

微信-支付宝

Copyright 1999-2018 Alibaba Group Holding Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

为监控而生的多级缓存框架 展开 收起
Java
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/yangsir/layering-cache.git
git@gitee.com:yangsir/layering-cache.git
yangsir
layering-cache
layering-cache
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891