Search in sources :

Example 1 with CacheOptions

use of info.evelio.carbonite.cache.CacheOptions in project carbonite by eveliotc.

the class CacheFactoryImp method buildFromOpts.

@SuppressWarnings("unchecked")
private Cache<String, T> buildFromOpts(CacheBuilder builder) {
    final CacheOptions opts = builder.opts();
    if (opts == null) {
        return null;
    }
    final Class<? extends Cache> type = opts.imp();
    final Cache<String, T> instance = newCacheInstance(type, opts);
    illegalState(!type.isInstance(instance), "Unable to instantiate cache, make sure it has a public constructor with proper options type.");
    return instance;
}
Also used : CacheOptions(info.evelio.carbonite.cache.CacheOptions)

Aggregations

CacheOptions (info.evelio.carbonite.cache.CacheOptions)1