package com.kym.common.cache;

import cn.hutool.cache.CacheUtil;
import cn.hutool.cache.impl.TimedCache;

/**
 * @author skyline
 * @description 动态数据缓存
 * @date 2023-11-08 22:02
 */
public enum DynamicDataCache {
    INSTANCE;

    /**
     * 缓存默认5min有效期
     */
    public static TimedCache<String, Object> timedCache = CacheUtil.newTimedCache(5 * 60 * 1000);

    public void put(String key, Object value) {
        timedCache.put(key, value);
    }

    public void put(String key, Object value, Long timeout) {
        timedCache.put(key, value, timeout);
    }

    public Object get(String key) {
        return timedCache.get(key);
    }

    public void remove(String key) {
        timedCache.remove(key);
    }

}
