springboot缓存自动刷新redis和apache ignite
Springboot cache auto refreshing with redis and apache ignite
我正在使用 java spring 引导应用程序,目前我正在使用 Redis 进行缓存。
现在我有一个需求,我需要每天刷新缓存。
作为初始级别,我每天手动刷新 redis 的缓存。
是否有自动配置?或者处理相同问题的最佳做法是什么?
我准备切换到任何替代方案,如 apache ignite。
提前致谢。
据我介绍,您可以尝试以下方法。
在 spring 启动你可以像下面这样写 cron。
@Scheduled(cron = "0 0/30 * * * ?") // execure after every 30 min
public void clearCacheSchedule(){
// write the code to clear the cache.
}
使用 Ignite,您可以为整个缓存或单个条目设置 expiration policies。
我正在使用 java spring 引导应用程序,目前我正在使用 Redis 进行缓存。
现在我有一个需求,我需要每天刷新缓存。
作为初始级别,我每天手动刷新 redis 的缓存。
是否有自动配置?或者处理相同问题的最佳做法是什么?
我准备切换到任何替代方案,如 apache ignite。
提前致谢。
据我介绍,您可以尝试以下方法。 在 spring 启动你可以像下面这样写 cron。
@Scheduled(cron = "0 0/30 * * * ?") // execure after every 30 min
public void clearCacheSchedule(){
// write the code to clear the cache.
}
使用 Ignite,您可以为整个缓存或单个条目设置 expiration policies。