mirror of
https://github.com/DerDavidBohl/dirigent-spring.git
synced 2026-05-04 03:10:31 -05:00
Fixed Cache Eviction
This commit is contained in:
+10
-1
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user