Builds a new {@link Cache} instance, and gets it's properties from the OSCache {@link Config}
which reads the properties file (oscache.properties
) from the classpath.
If the file cannot be found or loaded, an the defaults are used.
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;