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; }
public BoundedLoadingCache(Caffeine <K, V> builder, CacheLoader <K, V> loader) : base(builder, loader) { if (loader == null) { throw new ArgumentNullException("loader", "loader is a required parameter"); } mappingFunction = (key) => { // TODO: Removed all the catches, because they were really just throwing them anyway. return(loader.Load(key)); }; }
public BoundedLocalCacheStrongKeyStrongValueStatisticsEvictsBySize(Caffeine <K, V> builder, CacheLoader <K, V> loader, bool isAsync) : base(builder, loader, isAsync) { sketch = new FrequencySketch <K>(); if (builder.HasInitialCapacity) { long capacity = Math.Min(builder.Maximum, builder.InitialCapacity); sketch.EnsureCapacity((ulong)capacity); } accessOrderEdenDeque = builder.Evicts || builder.DoesExpireAfterAccess ? new AccessOrderDeque <Node <K, V> >() : null; accessOrderProbationDeque = new AccessOrderDeque <Node <K, V> >(); accessOrderProtectedQueue = new AccessOrderDeque <Node <K, V> >(); this.writeBuffer = new MpscGrowableArrayQueue <Task>(WRITE_BUFFER_MIN, WRITE_BUFFER_MAX); }
public UnboundedManualCache(Caffeine <K, V> builder) : base() { cache = new UnboundedLocalCache <K, V>(builder, false); }
public UnboundedAsyncLoadingCache(Caffeine <K, Task <V> > builder, AsyncCacheLoader <K, V> loader) : base(new UnboundedLocalCache <K, Task <V> >(builder, true), loader) { }
public UnboundedLocalCache(Caffeine <K, V> builder, bool isAsync) : this(builder, isAsync, NUM_CPUS + 2) { }
public BoundedManualCache(Caffeine <K, V> builder, CacheLoader <K, V> loader) { cache = CacheFactory <K, V> .Instance.NewBoundedLocalCache(builder, loader, false); isWeighted = builder.IsWeighted; }
public BoundedManualCache(Caffeine <K, V> builder) : this(builder, null) { }
public BoundedLocalCacheStrongKeyStrongValueStatistics(Caffeine <K, V> builder, CacheLoader <K, V> loader, bool isAsync) : base(builder, loader, isAsync) { statsCounter = builder.StatsCounter.Get(); }