Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
llhongGitHub opened this issue Nov 3, 2023 · 4 comments
Open

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

llhongGitHub opened this issue Nov 3, 2023 · 4 comments

Comments

@llhongGitHub
Copy link

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
Copy link
Collaborator

areyouok commented Nov 3, 2023

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

@llhongGitHub
Copy link
Author

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

@Yijiaoooooo
Copy link

同一个问题

@wuxiutong
Copy link

@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,此处不指定你注解中如何设置没用)。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants