package com.xingxi.api.configuration;


import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@Configuration
public class CacheConfiguration {

    @Bean("WxaMediaCheckGuavaCache")
    public Cache<String, Object> wxaMediaCheckGuavaCache() {
        return CacheBuilder.newBuilder()
                .concurrencyLevel(Runtime.getRuntime().availableProcessors())
                .initialCapacity(100)
                .maximumSize(500)
                .expireAfterWrite(40, TimeUnit.MINUTES).build();
    }

}
