public Cache(Builder<K,V> builder){
  this.id=builder.getId();
  this.strictJSR107=builder.isStrictJSR107();
  this.kvUtil=new KeyValueUtil<K,V>(id);
  this.builder=builder;
  tCacheJSR107=new TCacheJSR107<K,V>(this);
  this.maxCacheTime=builder.getMaxCacheTime();
  int spreadSeconds=(int)Math.min(Integer.MAX_VALUE,builder.getMaxCacheTimeSpread() / 1000);
  this.maxCacheTimeSpread=spreadSeconds;
  long expiryIdleMillis=0;
  ExpiryPolicy epFromFactory=builder.getExpiryPolicyFactory().create();
  if (strictJSR107) {
    this.expiryPolicy=new TouchedExpiryPolicy(epFromFactory);
  }
 else {
    this.expiryPolicy=new UntouchedExpiryPolicy(epFromFactory);
    Duration expiryDuration=epFromFactory.getExpiryForAccess();
    if (expiryDuration == null)     expiryDuration=epFromFactory.getExpiryForCreation();
    expiryIdleMillis=expiryDuration.getAdjustedTime(0);
  }
  if (expiryIdleMillis <= 0) {
    expiryIdleMillis=60_000;
  }
  this.cleanUpIntervalMillis=Math.min(5 * 60_000,expiryIdleMillis / 10);
  this.jamPolicy=builder.getJamPolicy();
  Factory<javax.cache.integration.CacheLoader<K,V>> lf=builder.getCacheLoaderFactory();
  if (lf != null) {
    this.loader=lf.create();
  }
 else {
    this.loader=builder.getLoader();
  }
  if (this.loader == null && builder.isReadThrough()) {
    throw new IllegalArgumentException("Builder has isReadThrough, but has no loader for cache: " + id);
  }
  Factory<CacheWriter<? super K,? super V>> cwFactory=builder.getCacheWriterFactory();
  if (cwFactory == null) {
    this.cacheWriter=new NopCacheWriter<K,V>();
  }
 else {
    CacheWriter<? super K,? super V> cw=cwFactory.create();
    CacheWriterWrapper<K,V> cwWrapper=new CacheWriterWrapper<K,V>(cw,false);
    this.cacheWriter=cwWrapper;
  }
  objects=createBackingMap(builder);
  enableStatistics(builder.getStatistics());
  enableManagement(builder.isManagementEnabled());
  activateTimeSource();
  listeners=new ListenerCollection<>(this,builder);
  tCacheJSR107.refreshActionRunners();
  builder.getFactory().registerCache(this);
  logger.info(this.toString());
}

public Cache ( Builder < K , V > builder ) { this . id = builder . getId ( ) ; this . strictJSR107 = builder . isStrictJSR107 ( ) ; this . kvUtil = new KeyValueUtil < K , V > ( id ) ; this . builder = builder ; tCacheJSR107 = new TCacheJSR107 < K , V > ( this ) ; this . maxCacheTime = builder . getMaxCacheTime ( ) ; int spreadSeconds = ( int ) Math . min ( Integer . MAX_VALUE , builder . getMaxCacheTimeSpread ( ) / 1000 ) ; this . maxCacheTimeSpread = spreadSeconds ; long expiryIdleMillis = 0 ; ExpiryPolicy epFromFactory = builder . getExpiryPolicyFactory ( ) . create ( ) ; if ( strictJSR107 ) { this . expiryPolicy = new TouchedExpiryPolicy ( epFromFactory ) ; } else { this . expiryPolicy = new UntouchedExpiryPolicy ( epFromFactory ) ; Duration expiryDuration = epFromFactory . getExpiryForAccess ( ) ; if ( expiryDuration == null ) expiryDuration = epFromFactory . getExpiryForCreation ( ) ; expiryIdleMillis = expiryDuration . getAdjustedTime ( 0 ) ; } if ( expiryIdleMillis <= 0 ) { expiryIdleMillis = 60_000 ; } this . cleanUpIntervalMillis = Math . min ( 5 * 60_000 , expiryIdleMillis / 10 ) ; this . jamPolicy = builder . getJamPolicy ( ) ; Factory < javax . cache . integration . CacheLoader < K , V > > lf = builder . getCacheLoaderFactory ( ) ; if ( lf != null ) { this . loader = lf . create ( ) ; } else { this . loader = builder . getLoader ( ) ; } if ( this . loader == null && builder . isReadThrough ( ) ) { throw new IllegalArgumentException ( "Builder has isReadThrough, but has no loader for cache: " + id ) ; } Factory < CacheWriter < ? super K , ? super V > > cwFactory = builder . getCacheWriterFactory ( ) ; if ( cwFactory == null ) { this . cacheWriter = new NopCacheWriter < K , V > ( ) ; } else { CacheWriter < ? super K , ? super V > cw = cwFactory . create ( ) ; CacheWriterWrapper < K , V > cwWrapper = new CacheWriterWrapper < K , V > ( cw , false ) ; this . cacheWriter = cwWrapper ; } objects = createBackingMap ( builder ) ; enableStatistics ( builder . getStatistics ( ) ) ; enableManagement ( builder . isManagementEnabled ( ) ) ; activateTimeSource ( ) ; listeners = new ListenerCollection < > ( this , builder ) ; tCacheJSR107 . refreshActionRunners ( ) ; builder . getFactory ( ) . registerCache ( this ) ; logger . info ( this . toString ( ) ) ; }
construct a cache , using the given configuration from the builder .
