// Path: bucket4j-spring-boot-starter/src/main/java/com/giffing/bucket4j/spring/boot/starter/config/cache/SyncCacheResolver.java
// public interface SyncCacheResolver extends CacheResolver {
// 
// }
// 
// Path: bucket4j-spring-boot-starter/src/main/java/com/giffing/bucket4j/spring/boot/starter/config/cache/infinispan/InfinispanCacheResolver.java
// public class InfinispanCacheResolver implements AsyncCacheResolver {
// 
// 	private CacheContainer cacheContainer;
// 	
// 	public InfinispanCacheResolver(CacheContainer cacheContainer) {
// 		this.cacheContainer = cacheContainer;
// 	}
// 	
// 	@Override
// 	public ProxyManager<String> resolve(String cacheName) {
// 		Cache<String, byte[]> cache = cacheContainer.getCache(cacheName);
// 
// 
// 		// TODO how to create an instance of ReadWriteMap
// 		return new InfinispanProxyManager<>(toMap(cache));
// 	}
// 
// 	private static FunctionalMap.ReadWriteMap<String, byte[]> toMap(Cache<String, byte[]> cache) {
// 		AdvancedCache<String, byte[]> advancedCache = cache.getAdvancedCache();
// 		FunctionalMapImpl<String, byte[]> functionalMap = FunctionalMapImpl.create(advancedCache);
// 		return ReadWriteMapImpl.create(functionalMap);
// 	}
// 
// }


import javax.cache.Caching;
import org.infinispan.manager.CacheContainer;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.cache.jcache.JCacheCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.giffing.bucket4j.spring.boot.starter.config.cache.SyncCacheResolver;
import com.giffing.bucket4j.spring.boot.starter.config.cache.infinispan.InfinispanCacheResolver;

package com.giffing.bucket4j.spring.boot.starter.config.cache.jcache;




/**
 * The configuration class for Infinispan. Infinispan is not directly supported by
 * bucket4j. See {@link InfinispanCacheResolver} for more informations.
 */
@Configuration
@ConditionalOnClass({ CacheContainer.class, Caching.class, JCacheCacheManager.class })
@ConditionalOnBean(CacheContainer.class)
public class InfinispanJCacheBucket4jConfiguration {

	private CacheContainer cacheContainer;
	
	public InfinispanJCacheBucket4jConfiguration(CacheContainer cacheContainer) {
		this.cacheContainer = cacheContainer;
	}
	
	@Bean

// Path: bucket4j-spring-boot-starter/src/main/java/com/giffing/bucket4j/spring/boot/starter/config/cache/SyncCacheResolver.java
// public interface SyncCacheResolver extends CacheResolver {
// 
// }
// 
// Path: bucket4j-spring-boot-starter/src/main/java/com/giffing/bucket4j/spring/boot/starter/config/cache/infinispan/InfinispanCacheResolver.java
// public class InfinispanCacheResolver implements AsyncCacheResolver {
// 
// 	private CacheContainer cacheContainer;
// 	
// 	public InfinispanCacheResolver(CacheContainer cacheContainer) {
// 		this.cacheContainer = cacheContainer;
// 	}
// 	
// 	@Override
// 	public ProxyManager<String> resolve(String cacheName) {
// 		Cache<String, byte[]> cache = cacheContainer.getCache(cacheName);
// 
// 
// 		// TODO how to create an instance of ReadWriteMap
// 		return new InfinispanProxyManager<>(toMap(cache));
// 	}
// 
// 	private static FunctionalMap.ReadWriteMap<String, byte[]> toMap(Cache<String, byte[]> cache) {
// 		AdvancedCache<String, byte[]> advancedCache = cache.getAdvancedCache();
// 		FunctionalMapImpl<String, byte[]> functionalMap = FunctionalMapImpl.create(advancedCache);
// 		return ReadWriteMapImpl.create(functionalMap);
// 	}
// 
// }


// Path: bucket4j-spring-boot-starter/src/main/java/com/giffing/bucket4j/spring/boot/starter/config/cache/jcache/InfinispanJCacheBucket4jConfiguration.java
import javax.cache.Caching;
import org.infinispan.manager.CacheContainer;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.cache.jcache.JCacheCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.giffing.bucket4j.spring.boot.starter.config.cache.SyncCacheResolver;
import com.giffing.bucket4j.spring.boot.starter.config.cache.infinispan.InfinispanCacheResolver;

package com.giffing.bucket4j.spring.boot.starter.config.cache.jcache;




/**
 * The configuration class for Infinispan. Infinispan is not directly supported by
 * bucket4j. See {@link InfinispanCacheResolver} for more informations.
 */
@Configuration
@ConditionalOnClass({ CacheContainer.class, Caching.class, JCacheCacheManager.class })
@ConditionalOnBean(CacheContainer.class)
public class InfinispanJCacheBucket4jConfiguration {

	private CacheContainer cacheContainer;
	
	public InfinispanJCacheBucket4jConfiguration(CacheContainer cacheContainer) {
		this.cacheContainer = cacheContainer;
	}
	
	@Bean

	public SyncCacheResolver bucket4jCacheResolver() {
