package thyyxxk.webserver.utils;

import java.util.concurrent.ConcurrentHashMap;

/**
 * @author dj
 */
public class ReadCardUtil {

    private final ConcurrentHashMap<String, String> rcMap;
    private static ReadCardUtil INSTANCE;

    private ReadCardUtil() {
        rcMap = new ConcurrentHashMap<>();
    }

    public static ReadCardUtil instance() {
        synchronized (ReadCardUtil.class) {
            if (null == INSTANCE) {
                synchronized (ReadCardUtil.class) {
                    INSTANCE = new ReadCardUtil();
                }
            }
        }
        return INSTANCE;
    }

    public void put(String key, String val) {
        rcMap.put(key, val);
    }

    public String get(String key) {
        return rcMap.get(key);
    }

}
