public UnboundedLocalCache(Caffeine <K, V> builder, bool isAsync, int concurrencyLevel) { this.data = new ConcurrentDictionary <K, V>(concurrencyLevel, builder.InitialCapacity); this.statsCounter = builder.StatsCounter.Get(); this.removalListener = builder.RemovalListener; this.isRecordingStats = builder.IsRecordingStats; this.writer = builder.Writer; this.ticker = builder.Ticker; }
/// <summary> /// Specifies a listener instance that caches should notify each time an entry is removed for any /// <see cref="RemovalCause"/> reason. Each cache created by this builder will invoke this listener /// as part of the routine maintenance describe in the class documentation above. /// </summary> /// <param name="removalListener">A listener instance that caches should notify each time an entry is removed.</param> /// <exception cref="InvalidOperationException">If a removal listener was already set.</exception> /// <exception cref="ArgumentNullException">If the <paramref name="removalListener"/> is <see langword="null"/></exception> public Caffeine <K, V> SpecifyRemovalListener(IRemovalListener <K, V> removalListener) { RemovalListener = removalListener; return(this); }
public AsyncRemovalListener(IRemovalListener <K, V> @delegate) { this.@delegate = @delegate; }