All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fatjar.implementations.cache.CurrentCache Maven / Gradle / Ivy

There is a newer version: 1.3.0
Show newest version
package fatjar.implementations.cache;

import fatjar.Cache;

public class CurrentCache {

    private CurrentCache() throws Exception {
        throw new Exception("never call constructor, use create method");
    }

    public static Cache create(Cache.Type type, String name) {
        Cache cache;
        switch (type) {
            case Memcache:
                cache = new MemCache<>(name);
                break;
            case Redis:
                cache = new RedisCache<>(name);
                break;
            default:
                cache = new MapCache<>(name);
                break;
        }
        return cache;
    }

    public static Cache create(String name) {
        return create(Cache.Type.Map, name);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy