All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.dengchen2020.cache.caffeine.CaffeineCacheSyncAutoConfiguration Maven / Gradle / Ivy

package io.github.dengchen2020.cache.caffeine;

import io.github.dengchen2020.cache.listener.CacheSyncMessageListener;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.MessageListener;

/**
 * Caffeine缓存同步自动配置
 * 

依赖redis的发布订阅,需引入

*
{@code
 * 
 *     org.springframework.boot
 *     spring-boot-starter-data-redis
 * }
* * @author dengchen * @since 2024/7/3 */ @ConditionalOnClass(MessageListener.class) @ConditionalOnBean(CaffeineCacheManager.class) @AutoConfigureAfter(CaffeineCacheAutoConfiguration.class) @Configuration(proxyBeanMethods = false) public class CaffeineCacheSyncAutoConfiguration { @Bean public CacheSyncMessageListener cacheSyncMessageListener(CacheManager cacheManager){ return new CacheSyncMessageListener(cacheManager); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy