package net.vtstar.zhongtong.avi.global.config;

import org.springframework.cache.Cache;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

@Configuration
@EnableCaching
public class CacheConfig {

    @Bean
    @Primary
    ConcurrentMapCacheManager cacheManager() {
        ConcurrentMapCacheManager cacheManager = new ConcurrentMapCacheManager();
        return cacheManager;
    }

    @Bean
    Cache showFieldCache(ConcurrentMapCacheManager cacheManager) {
        return cacheManager.getCache("showFieldCache");
    }

    @Bean
    Cache stationCache(ConcurrentMapCacheManager cacheManager) {
        return cacheManager.getCache("stationCache");
    }
}
