[Unit Tests [Integration Tests
A Cache Refresh-Ahead Spring Boot Starter for Caffeine and Redis cache!
This starter enables Refresh-Ahead Caching. This enables clients to benefit from the speed of caching while the application keeps the cache closely up-to-date. The client will not feel any impact of the slow source behind the cache.
Currently, only Caffeine and Redis Cache is supported.
You can find examples of how to use the library at https://github.com/SvenBayer/cache-refresh-ahead-samples
You have to add @EnableCaching to your project and define a CacheManager bean.
Add the Spring Boot starter to your maven pom. Define the expiration of your cache values.
Define the cache refresh intervals in your application.properties/yml. You can either define a global interval, or specify an interval for each cache separately. For example, the first line specifies that the caches are reloaded every 5 seconds. The second line specifies that only the cache named longrun is being reloaded every 5 seconds.
cache.reload.ahead.refresh-ahead-interval=5s
cache.reload.ahead.refresh-ahead-interval-caches.longrun=5s
Visit my blog at https://svenbayer.blog