package com.muyu.carData.config.cacheconfig;

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author：张腾
 * @Package：com.muyu.carData.cacheconfig
 * @Project：cloud-server-8
 * @name：CaffeineConfig
 * @Date：2024/9/26 23:51
 */
@Configuration
public class CaffeineConfig {

    @Bean
    public Cache<String, ? extends ExpiryTime> caffeineCache(){
        CacheExpiry cacheExpiry = new CacheExpiry();
        return Caffeine.newBuilder()
                .expireAfter(cacheExpiry)
                .initialCapacity(128)
                .build();
    }
}
