java - springboot缓存自动刷新redis和apache ignite

标签 java spring spring-boot redis ignite

我正在使用 java spring boot 应用程序,目前我正在使用 Redis 进行缓存。

现在我有一个需求,我需要每天刷新缓存。

作为初始级别,我每天手动刷新 redis 的缓存。

是否有任何配置可以使其自动化?或者处理相同问题的最佳做法是什么?

我已准备好切换到任何替代方案,如 apache ignite。

提前致谢。

最佳答案

根据我的说法,您可以尝试以下操作。 在 spring boot 中,您可以像下面这样编写 cron。

@Scheduled(cron = "0 0/30 * * * ?")              // execure after every 30 min
public void clearCacheSchedule(){
    // write the code to clear the cache.
}

关于java - springboot缓存自动刷新redis和apache ignite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57264580/

相关文章:

java - 无法在 Java 8 中将 int 转换为 long

java - 没有这样的字段错误: NULL Spring Error

java - AutowireCapableBeanFactory.autowireBeanProperties() 似乎不适用于 xml 配置的上下文

java - Spring Boot 表单输入为空

java - 使用 Spring Boot 应用程序将数据库凭据作为 Quartz API 中的命令行输入传递

java - 使用 Java 客户端 API 在 marklogic 中创建或添加集合

java - 在 Jersey 2 中使用 Hystrix Java Servlet 和 Servlet 过滤器

java - Spring Boot/JPA/mySQL - 多对一关系创建了太多 SQL 查询

java - Spring AOP : Annotation pointcut not causing advice to execute

spring - 如何在 spring-rest-oauth 中基于 oauth 范围限制方法访问?