alibaba / jetcache

JetCache is a Java cache framework.
Apache License 2.0
5.03k stars 1.05k forks source link

jetcache.remote.${area}.broadcastChannel 配置不生效 #832

Open llhongGitHub opened 10 months ago

llhongGitHub commented 10 months ago

spring-boot-dependencies: 2.6.13
jetcache-starter-redi: 2.7.4

jetcache.remote.default.type=redis jetcache.remote.default.broadcastChannel=projectA

broadcastChannel 不起作用 ,一个节点修改 local+remote 然后立刻获取 显示生效, 但一个节点 local 还是之前的数据

areyouok commented 10 months ago

那是个总开关,不能所有的缓存更新都广播。注解上还需要打开syncLocal,才会生效

llhongGitHub commented 10 months ago

@Cached(name = "user", key = "#username", expire = 3600, localExpire = 180, syncLocal = true, cacheType = CacheType.BOTH) 也是不起作用

Yijiaoooooo commented 10 months ago

同一个问题

wuxiutong commented 8 months ago

@cached(name = "user", key = "#username", expire = 3600, localExpire = 180, syncLocal = true, cacheType = CacheType.BOTH) 也是不起作用 我刚开始也是不生效,找了还就才发现我是自己写了个Configuration(Spring Boot)显式的初始化全局一次性初始化cache的导致未初始化时的syncLocal没有指定导致的。 推荐检查思路: 1、首先检查redis是否开启的事件通知,配置文件(通常是redis.conf)中notify-keyspace-events我设置值是Egx image 2、检查你的代码中@cached中是否开启syncLocal = true(我看你已经开启了) 3、如果你是显式的初始化cache,查看你的代码中是否使用QuickConfig同CacheManager的getOrCreateCache(QuickConfig config)来初始化cache,初始化时的QuickConfig.builder中有个参数是syncLocal需要显示指定为true(默认未指定就是false,此处不指定你注解中如何设置没用)。