[重大更新] 新增 PlusCacheWrapper装饰器 为SpringCache增加本地缓存减少redis查询提高性能(尝试性更新问题未知 请勿轻易更新尝试)

This commit is contained in:
疯狂的狮子Li
2024-01-03 10:25:23 +08:00
parent df5edb67f0
commit 57318cc55d
6 changed files with 110 additions and 33 deletions

View File

@ -15,6 +15,8 @@ import java.util.concurrent.TimeUnit;
/**
* Sa-Token持久层接口(使用框架自带RedisUtils实现 协议统一)
* <p>
* 采用 caffeine + redis 多级缓存 优化并发查询效率
*
* @author Lion Li
*/
@ -22,7 +24,7 @@ public class PlusSaTokenDao implements SaTokenDao {
private static final Cache<String, Object> CAFFEINE = Caffeine.newBuilder()
// 设置最后一次写入或访问后经过固定时间过期
.expireAfterWrite(10, TimeUnit.SECONDS)
.expireAfterWrite(5, TimeUnit.SECONDS)
// 初始的缓存空间大小
.initialCapacity(100)
// 缓存的最大条数