com.github.bootfastconfig.cache.RedisCaffeineL2CacheManager Maven / Gradle / Ivy
package com.github.bootfastconfig.cache;
import com.github.bootfastconfig.cache.l2cache.L2Cache;
import com.github.bootfastconfig.cache.properties.L2CacheProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.data.redis.core.RedisTemplate;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* @author mister
* 一个二级缓存Manager
*/
public class RedisCaffeineL2CacheManager implements CacheManager {
private final static Logger log = LoggerFactory.getLogger(RedisCaffeineL2CacheManager.class);
/**
* 一级缓存 Manager
*/
private CacheManager cacheManager1;
/**
* 二级缓存 Manager
*/
private CacheManager cacheManager2;
private ConcurrentMap cacheMap = new ConcurrentHashMap();
private L2CacheProperties l2CacheProperties;
private boolean dynamic = true;
private RedisTemplate