Fixed Cache Eviction

This commit is contained in:
DerDavidBohl
2025-06-25 14:56:30 +02:00
parent 8a48dc49bf
commit 1ac2468d70
@@ -1,11 +1,14 @@
package org.davidbohl.dirigent.deployments.config;
import lombok.extern.slf4j.Slf4j;
import org.davidbohl.dirigent.deployments.models.DeploynentConfiguration;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class CachedDeploymentsConfigurationProvider {
private final DeploymentsConfigurationProvider deploymentsConfigurationProvider;
@@ -16,9 +19,15 @@ public class CachedDeploymentsConfigurationProvider {
@Cacheable("deploymentsConfiguration")
@Scheduled(fixedDelay = 5000)
public DeploynentConfiguration getCachedConfiguration() {
return this.deploymentsConfigurationProvider.getConfiguration();
}
@CacheEvict(value = "deploymentsConfiguration", allEntries = true)
@Scheduled(fixedDelay = 60000)
public void evictCachedConfiguration() {
log.info("Evicting cached deployments configuration");
}
}