private Map<CacheCategory, CacheService> createCaches(CacheInfo cacheInfo) {
   Map<CacheCategory, CacheService> ciCaches = new HashMap<CacheCategory, CacheService>();
   for (Map.Entry<CacheCategory, CacheConfiguration> entry :
       cacheInfo.getConfiguration().entrySet()) {
     if (entry.getValue() instanceof InfinispanConfiguration) {
       CacheService cacheService;
       CacheCategory category = entry.getKey();
       InfinispanConfiguration config = (InfinispanConfiguration) entry.getValue();
       if (config.isCacheEnabled()) {
         String configurationName = config.getConfigurationName();
         if (null == configurationName) {
           Configuration dcc = manager.getDefaultCacheConfiguration();
           Configuration infinispan =
               config.getInfinispanConfiguration(new ConfigurationBuilder().read(dcc));
           configurationName = "$" + category.getName() + "$" + cacheInfo.getId();
           manager.defineConfiguration(configurationName, infinispan);
         }
         recorder.record("infinispan", "configuration name " + configurationName);
         cacheService =
             new InfinispanCacheService(manager.<String, Object>getCache(configurationName));
       } else {
         cacheService = noCacheFactory.create(null, category);
       }
       ciCaches.put(category, cacheService);
     }
   }
   return ciCaches;
 }
 /**
  * Add layer specific cache configuration in the caches variable. This assures each cache is only
  * built once and possibly reused (thanks to cacheCache).
  *
  * @param cacheCache cache for built caches
  * @param layer layer (or null)
  * @param cacheInfo cache configuration info
  */
 private void setCaches(
     Map<String, Map<CacheCategory, CacheService>> cacheCache, Layer layer, CacheInfo cacheInfo) {
   Map<CacheCategory, CacheService> ciCaches;
   ciCaches = cacheCache.get(cacheInfo.getId());
   if (null == ciCaches) {
     ciCaches = createCaches(cacheInfo);
     cacheCache.put(cacheInfo.getId(), ciCaches);
   }
   for (Map.Entry<CacheCategory, CacheService> ciEntry : ciCaches.entrySet()) {
     CacheSelector cs = new CacheSelector(ciEntry.getKey(), layer);
     caches.put(cs, ciEntry.getValue());
   }
 }