Do I need to evict redis cache manually in multi-server environment? #125
Replies: 1 comment
-
@MarcGiffing @ttulka hello guys, A few month ago, I implemented smart TTL calculation for Redis entries, so it is not nessesary(in case of redis) to specify global TTL. If I understand correctly you don't use built-in to Bucket4j integrations for Redis and implemented own instead, so you can adopt my code into your integration in order to free your clients from specifiyng TTL. |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for the starter :)
I'm using bucket4j and your starter to set up rate limits for several endpoints in my Spring boot application which is deployed to the server in production with several instances so I'm using Redis as the storage. My question is, do I need to manually evict the cache periodically? There are many requests coming to the server so if it's not evicted, it would probably be filled up very soon.
I use
currencyRateCache
with@Cacheable
annotation so I'm using@CacheEvict
for this cache. But do I really need evicting forapiRequestsThrottlingCache
as well?Here's my Redis Configuration:
Here's my bucket4j configuration:
I'm limited to Java 8 and Spring Boot 2.6.1 so I'm using
bucket4j-spring-boot-starter
of version0.6.1
andbucket4j-core
withbucket4j-redis
of version7.6.0
.Beta Was this translation helpful? Give feedback.
All reactions