package cn.palmte.work.service.map;

import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * @author xiongshiyan at 2021/5/18 , contact me with email yanshixiong@126.com or phone 15208384257
 */
public class MemorySimpleMap<K,V> implements SimpleMap<K,V>{
    private ConcurrentMap<K,V> concurrentMap = new ConcurrentHashMap<>();

    @Override
    public V get(K k) {
        return concurrentMap.get(k);
    }

    @Override
    public V delete(K k) {
        return concurrentMap.remove(k);
    }

    @Override
    public void set(K k, V v, long expireIns) {
        concurrentMap.put(k,v);
    }

    @Override
    public Set<K> keys() {
        return concurrentMap.keySet();
    }
}
