com.infusers.core.cache.redis.CacheShutdownHook Maven / Gradle / Ivy
package com.infusers.core.cache.redis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import jakarta.annotation.PreDestroy;
@Component
@ConditionalOnProperty(name = "redis.hostname")
public class CacheShutdownHook {
@Autowired
private CacheClearingComponent cacheClearingComponent;
@PreDestroy
public void clearCacheOnShutdown() {
// Perform cache clearing on application shutdown
this.cacheClearingComponent.clearCache();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy