package com.njzscloud.common.cache;

import cn.hutool.extra.spring.SpringUtil;

import java.util.function.Supplier;

public final class Caches {

    public static final Cache CACHE = SpringUtil.getBean(Cache.class);

    public static <T> T get(String key) {
        return CACHE.get(key);
    }

    public static <T> T get(String key, long timeout, Supplier<T> supplier) {
        return CACHE.get(key, timeout, supplier);
    }

    public static void put(String key, Object value, long timeout) {
        CACHE.put(key, value, timeout);
    }

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

    public static void remove(String key) {
        CACHE.remove(key);
    }
}
