public Cache buildCache(String region,
Properties properties) throws CacheException {
int refreshPeriod = PropertiesHelper.getInt(
StringHelper.qualify(region, OSCACHE_REFRESH_PERIOD),
OSCACHE_PROPERTIES,
CacheEntry.INDEFINITE_EXPIRY
);
String cron = OSCACHE_PROPERTIES.getProperty( StringHelper.qualify(region, OSCACHE_CRON) );
// construct the cache
final OSCache cache = new OSCache(refreshPeriod, cron, region);
Integer capacity = PropertiesHelper.getInteger( StringHelper.qualify(region, OSCACHE_CAPACITY), OSCACHE_PROPERTIES );
if ( capacity!=null ) cache.setCacheCapacity( capacity.intValue() );
return cache;
}
Builds a new Cache instance, and gets it's properties from the OSCache Config
which reads the properties file (oscache.properties) from the classpath.
If the file cannot be found or loaded, an the defaults are used. |