Closed xinlunanxinlunan closed 11 months ago
Hey. That's a resonable behavior given your config. You have set expireAfterAccess=30s
which means that everytime you access cache this period gets reseted again to 30s. If A is constantly asking for cache than this cache never expires. If A stops calling B for 30s than this cache would expire and A would get a new one.
@xinlunanxinlunan Please read the comment above added by @sobelek and let us know if you have additional feedback.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Describe the bug Hello, our calling relationship A->B, B has two instances (B1,B2). Set the ttl to 30s, and continue to send requests to A. If B2 is offline, A's cache is not updated. As A result, an error occurs when A calls B2. In this case, traffic must be disabled for the cache of A to be updated.
I don't think it's a reasonable design.
Thank you.
test sample version springboot version 3.1.0, spring-cloud 2022.0.2 spring-cloud-alibaba 2022.0.0.0-RC2 dependency groupId:org.springframework.boot artifactId:spring-boot-starter-cache
groupId:com.github.ben-manes.caffeine artifactId:caffeine ''' configuration spring.cloud.loadbalancer.cache.capacity=512 spring.cloud.loadbalancer.cache.ttl=30s spring.cloud.loadbalancer.cache.caffeine.spec=maximumSize=512, expireAfterAccess=30s