com.github.bootfastconfig.cache.redis.RedisCacheConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of boot-fast-config-cache Show documentation
Show all versions of boot-fast-config-cache Show documentation
Parent pom providing dependency and plugin management for applications
built with Maven
The newest version!
package com.github.bootfastconfig.cache.redis;
import com.github.bootfastconfig.cache.CacheBuilder;
import com.github.bootfastconfig.cache.CacheConfig;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Consumer;
public class RedisCacheConfig implements CacheConfig> {
private final List> redisCacheBuilder;
private RedisCacheConfiguration defaultRedisCacheConfig;
public RedisCacheConfig() {
redisCacheBuilder = new LinkedList<>();
}
public void addDefaultCache(RedisCacheConfiguration cacheBuilder) {
if (this.defaultRedisCacheConfig == null) {
this.defaultRedisCacheConfig = cacheBuilder;
}
}
public RedisCacheConfiguration getDefaultCache() {
return defaultRedisCacheConfig;
}
@Override
public void importCacheBuilder(CacheConfig> cacheConfig) {
Collection> cacheBuilder = cacheConfig.getCacheBuilder();
addCaches(cacheBuilder);
}
@Override
public Collection> getCacheBuilder() {
return redisCacheBuilder;
}
@Override
public void addCache(CacheBuilder cache) {
redisCacheBuilder.add(cache);
}
@Override
public void addCaches(Collection> caches) {
redisCacheBuilder.addAll(caches);
}
@Override
public void exportConsumer(Consumer> cacheManager) {
}
}