File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
BitFaster.Caching.ThroughputAnalysis Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 11
2+ using System ;
23using System . Collections . Generic ;
34using System . Data ;
45using BitFaster . Caching . Lfu ;
@@ -105,6 +106,35 @@ public ConcurrentLfuFactory(int capacity)
105106 }
106107 }
107108
109+ public class ConcurrentTLfuFactory : ICacheFactory
110+ {
111+ private readonly int capacity ;
112+
113+ public ConcurrentTLfuFactory ( int capacity )
114+ {
115+ this . capacity = capacity ;
116+ }
117+
118+ public string Name => "ConcurrentTLfu" ;
119+
120+ public DataRow DataRow { get ; set ; }
121+
122+ public ( IScheduler , ICache < long , int > ) Create ( int threadCount )
123+ {
124+ var scheduler = new BackgroundThreadScheduler ( ) ;
125+
126+ var cache = new ConcurrentLfuBuilder < long , int > ( )
127+ . WithCapacity ( capacity )
128+ . WithScheduler ( scheduler )
129+ . WithConcurrencyLevel ( threadCount )
130+ . WithKeyComparer ( EqualityComparer < long > . Default )
131+ . WithExpireAfterWrite ( TimeSpan . FromHours ( 1 ) )
132+ . Build ( ) ;
133+
134+ return ( scheduler , cache ) ;
135+ }
136+ }
137+
108138 public class ClassicLruFactory : ICacheFactory
109139 {
110140 private readonly int capacity ;
You can’t perform that action at this time.
0 commit comments