32 lines
723 B
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();
|
|
}
|
|
|
|
}
|