com.github.zhengframework.cache.simple.SimpleCachingProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zheng-cache Show documentation
Show all versions of zheng-cache Show documentation
zheng framework module: cache support
package com.github.zhengframework.cache.simple;
import java.net.URI;
import java.util.Properties;
import javax.cache.CacheManager;
import javax.cache.configuration.OptionalFeature;
import javax.cache.spi.CachingProvider;
public class SimpleCachingProvider implements CachingProvider {
private final SimpleCacheManager cacheManager;
public SimpleCachingProvider() {
cacheManager = new SimpleCacheManager(this);
}
@Override
public CacheManager getCacheManager(URI uri, ClassLoader classLoader, Properties properties) {
return cacheManager;
}
@Override
public ClassLoader getDefaultClassLoader() {
return SimpleCachingProvider.class.getClassLoader();
}
@Override
public URI getDefaultURI() {
return URI.create("map://default");
}
@Override
public Properties getDefaultProperties() {
return null;
}
@Override
public CacheManager getCacheManager(URI uri, ClassLoader classLoader) {
return cacheManager;
}
@Override
public CacheManager getCacheManager() {
return cacheManager;
}
@Override
public void close() {
cacheManager.close();
}
@Override
public void close(ClassLoader classLoader) {
cacheManager.close();
}
@Override
public void close(URI uri, ClassLoader classLoader) {
cacheManager.close();
}
@Override
public boolean isSupported(OptionalFeature optionalFeature) {
return false;
}
}