fatjar.implementations.cache.CurrentCache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of FatJar Show documentation
Show all versions of FatJar Show documentation
FatJar simple API to quick prototyping and portable web services
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);
}
}