Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions BitFaster.Caching.ThroughputAnalysis/CacheFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

using System;
using System.Collections.Generic;
using System.Data;
using BitFaster.Caching.Lfu;
Expand Down Expand Up @@ -105,6 +106,35 @@ public ConcurrentLfuFactory(int capacity)
}
}

public class ConcurrentTLfuFactory : ICacheFactory
{
private readonly int capacity;

public ConcurrentTLfuFactory(int capacity)
{
this.capacity = capacity;
}

public string Name => "ConcurrentTLfu";

public DataRow DataRow { get; set; }

public (IScheduler, ICache<long, int>) Create(int threadCount)
{
var scheduler = new BackgroundThreadScheduler();

var cache = new ConcurrentLfuBuilder<long, int>()
.WithCapacity(capacity)
.WithScheduler(scheduler)
.WithConcurrencyLevel(threadCount)
.WithKeyComparer(EqualityComparer<long>.Default)
.WithExpireAfterWrite(TimeSpan.FromHours(1))
.Build();

return (scheduler, cache);
}
}

public class ClassicLruFactory : ICacheFactory
{
private readonly int capacity;
Expand Down