package thyyxxk.webserver.service.hutoolcache;

import cn.hutool.cache.impl.CacheObj;

import java.util.*;

public interface HutoolCacheInterface<T> {

    void put(String key, T value);

    T get(String key);


    void del(String key);

    void clear();

    List<CacheAll> getAll();

    default void refreshCache(String key) {

    }

    default String getLabel() {
        return null;
    }

    default List<CacheAll> getAllUtils(Iterator<CacheObj<String, T>> cacheObjIterator) {
        List<CacheAll> list = new ArrayList<>();

        cacheObjIterator.forEachRemaining(i -> {
            list.add(new CacheAll(i.getKey(), i.getValue()));
        });

        return list;
    }


}

