Skip to content

jetcache不能跨服务吗? #991

@Ryoui

Description

@Ryoui

a服务缓存后,在b服务更新或删除缓存,a服务缓存的并没更新或删除。不知道能不能这样用。我试过在同一个服务(不同类),缓存、更新删除是正常的。
spring boot 2.7,jetcache2.7.8

a服务方法:
@Cached(name = "appCache", key = "#appId", expire = 30 * 24 * 60 * 60, localExpire = 7 * 24 * 60 * 60, cacheType = CacheType.BOTH, localLimit = 256, keyConvertor = KeyConvertor.FASTJSON2, syncLocal = true) @CachePenetrationProtect @Override public SingleResponse<AppDataDTO> getByAppId(String appId) { // 业务处理 return SingleResponse.of(dto); }
b服务方法:
@CacheInvalidate(name = "appCache", key = "#appId", condition = "result.success") @Override public Response updateStatus(String appId, boolean enable) { // 业务处理 return Response.buildSuccess("); }
jetcache配置:
`# 二级缓存
jetcache:
statIntervalMinutes: 1
areaInCacheName: false
hiddenPackages: com.test

本地缓存

local:
default:
type: caffeine
keyConvertor: fastjson2
limit: 512

远程缓存

remote:
default:
type: redis.lettuce
uri: redis://127.0.0.1:6379/1
keyConvertor: fastjson2
broadcastChannel: ipp-cache-channel
eventConsumerThreads: 10
valueEncoder: java
valueDecoder: java`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions