Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring@cacheable如何刷新缓存12am?_Java_Spring_Caching_Spring Cache_Spring Scheduled - Fatal编程技术网

Java Spring@cacheable如何刷新缓存12am?

Java Spring@cacheable如何刷新缓存12am?,java,spring,caching,spring-cache,spring-scheduled,Java,Spring,Caching,Spring Cache,Spring Scheduled,我想每天12点刷新缓存,或者缓存在12点过期。我已经检查了net.sf.ehcache.config.CacheConfiguration中的可用方法,但是这些方法,即timeToIdleSeconds,timeToLiveSeconds似乎不是我想要的。我可以知道如何做到这一点吗 编辑1: 下面是我如何使用@Cacheable的 @Override @Cacheable(value = "cacheName") public Object retrieveConfigurations() {

我想每天12点刷新缓存,或者缓存在12点过期。我已经检查了
net.sf.ehcache.config.CacheConfiguration
中的可用方法,但是这些方法,即
timeToIdleSeconds
timeToLiveSeconds
似乎不是我想要的。我可以知道如何做到这一点吗

编辑1:

下面是我如何使用@Cacheable的

@Override
@Cacheable(value = "cacheName")
public Object retrieveConfigurations() {
    ...
}

您可以使用
@Scheduled

@Scheduled(cron = "<cron expression>")
@CacheEvict(value = "<cache name>")
public void clearCache() {      
}

@已计划(cron=”“)
@cacheexecute(value=”“)
public void clearCache(){
}

看看spring调度,您可以使用此命令清除缓存。参考