package com.ruoyi.common.third.cache;

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

public abstract class AbstractHzCacheManager implements HzCacheManager {
    private static final ConcurrentMap<String, HzCache> CACHE_MAP = new ConcurrentHashMap<>();

    @Override
    public HzCache getCache(String cacheName) {
        HzCache cache = CACHE_MAP.get(cacheName);
        if (cache == null) {
            cache = getMissingCache(cacheName);
            CACHE_MAP.putIfAbsent(cacheName, cache);
        }
        return cache;
    }
}
