/** * This method will check if a cache already exists for given cache type and create in case * it is not present in the map * * @param cacheType type of cache * @param <K> * @param <V> * @return */ public <K, V> Cache<K, V> createCache(CacheType cacheType) { //check if lru cache is null, if null create one //check if cache is null for given cache type, if null create one if (!dictionaryCacheAlreadyExists(cacheType)) { synchronized (lock) { if (!dictionaryCacheAlreadyExists(cacheType)) { if (null == carbonLRUCache) { createLRULevelCacheInstance(); } createDictionaryCacheForGivenType(cacheType); } } } return cacheTypeToCacheMap.get(cacheType); }