private Map<K, V> map() {
        Map<K, V> map = ref != null ? ref.get() : null;
        if (map == null) {
            synchronized(this) {
                map = ref != null ? ref.get() : null;
                if (map == null) {
                    map = createCache(capacity, loadFactor, synchro);
                    ref = new SoftReference<>(map);
                }
            }
        }
        return map;
    }
Gets a value from cache.
@param key the cache entry key
@return the cache entry value
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/properties/SoftCache.java