This repository has been archived on 2023-01-25. You can view files and clone it, but cannot push or open issues or pull requests.
catalogue-ws/src/main/java/org/gcube/datacatalogue/catalogue/utils/CachesManager.java

32 lines
723 B
Java

package org.gcube.datacatalogue.catalogue.utils;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
/**
* Handle caches via Ehcache
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class CachesManager {
private static CacheManager cacheManager;
public static final CachesManager singleton = new CachesManager();
public static final String PROFILES_READERS_CACHE = "profile_readers";
private CachesManager(){
cacheManager = CacheManager.newInstance();
}
public static Cache getCache(String name){
return cacheManager.getCache(name);
}
@Override
protected void finalize() throws Throwable {
super.finalize();
cacheManager.shutdown();
}
}