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

com.github.bootfastconfig.cache.redis.RedisCacheConfig Maven / Gradle / Ivy

Go to download

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) {

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy