// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
package dbcache;

import java.net.URI;
import java.net.URISyntaxException;

import javax.cache.Caching;
import javax.cache.configuration.MutableConfiguration;

public class DAL_RemoteCache extends DAL_Cache {
    public DAL_RemoteCache(DAL real) throws URISyntaxException {
        super(real);
        // this implementation use Apache Ignite which is a relative common choice for remote cache
        cp = Caching.getCachingProvider("org.apache.ignite.cache.CachingProvider");
        cm = cp.getCacheManager(new URI("file:/C:/Work/ignite.xml"), null, null);
        big_cache = cm.getCache("remote_big_cache");
        if(big_cache == null) {
            big_cache = cm.createCache("remote_big_cache", new MutableConfiguration<Integer,Big>());
        }
        counter_cache = cm.getCache("remote_counter_cache");
        if(counter_cache == null) {
            counter_cache = cm.createCache("remote_counter_cache", new MutableConfiguration<String,Integer>());
        }
    }
}
