@@ -66,7 +66,7 @@ public void WhenItemsAddedExceedsCapacityItemsAreDiscarded()
6666 cache . GetOrAdd ( i , k => k ) ;
6767 }
6868
69- cache . PendingMaintenance ( ) ;
69+ cache . DoMaintenance ( ) ;
7070 LogLru ( ) ;
7171
7272 cache . Count . Should ( ) . Be ( 20 ) ;
@@ -84,7 +84,7 @@ public void WhenItemIsEvictedItIsDisposed()
8484 dcache . GetOrAdd ( i , k => disposables [ i ] ) ;
8585 }
8686
87- dcache . PendingMaintenance ( ) ;
87+ dcache . DoMaintenance ( ) ;
8888 LogLru ( ) ;
8989
9090 dcache . Count . Should ( ) . Be ( 20 ) ;
@@ -103,7 +103,7 @@ public void WhenNewItemsAreAddedTheyArePromotedBasedOnFrequency()
103103 }
104104
105105 // W [19] Protected [] Probation [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]
106- cache . PendingMaintenance ( ) ;
106+ cache . DoMaintenance ( ) ;
107107 LogLru ( ) ;
108108
109109 for ( int i = 0 ; i < 15 ; i ++ )
@@ -112,7 +112,7 @@ public void WhenNewItemsAreAddedTheyArePromotedBasedOnFrequency()
112112 }
113113
114114 // W [19] Protected [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14] Probation [15,16,17,18]
115- cache . PendingMaintenance ( ) ;
115+ cache . DoMaintenance ( ) ;
116116 LogLru ( ) ;
117117
118118 for ( int k = 0 ; k < 2 ; k ++ )
@@ -123,7 +123,7 @@ public void WhenNewItemsAreAddedTheyArePromotedBasedOnFrequency()
123123 {
124124 cache . GetOrAdd ( j + 20 , k => k ) ;
125125 }
126- cache . PendingMaintenance ( ) ;
126+ cache . DoMaintenance ( ) ;
127127 LogLru ( ) ;
128128 }
129129 }
@@ -145,7 +145,7 @@ public void WhenNewItemsAreAddedTheyArePromotedBasedOnFrequency()
145145
146146 // W [24] Protected [5,6,7,8,9,10,11,12,13,14,20,21,22,23,25] Probation []
147147 cache . Trim ( 4 ) ;
148- cache . PendingMaintenance ( ) ;
148+ cache . DoMaintenance ( ) ;
149149 LogLru ( ) ;
150150
151151 cache . TryGet ( 1 , out var value1 ) . Should ( ) . BeFalse ( ) ;
@@ -162,12 +162,12 @@ public void ReadPromotesProbation()
162162 }
163163
164164 // W [19] Protected [] Probation [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]
165- cache . PendingMaintenance ( ) ;
165+ cache . DoMaintenance ( ) ;
166166 LogLru ( ) ;
167167
168168 // W [19] Protected [16] Probation [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17,18]
169169 cache . GetOrAdd ( 16 , k => k ) ;
170- cache . PendingMaintenance ( ) ;
170+ cache . DoMaintenance ( ) ;
171171 LogLru ( ) ;
172172
173173 for ( int i = 25 ; i < 50 ; i ++ )
@@ -177,13 +177,13 @@ public void ReadPromotesProbation()
177177 }
178178
179179 // W [49] Protected [16] Probation [25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42]
180- cache . PendingMaintenance ( ) ;
180+ cache . DoMaintenance ( ) ;
181181 LogLru ( ) ;
182182
183183 cache . Trim ( 18 ) ;
184184
185185 // W [49] Protected [16] Probation []
186- cache . PendingMaintenance ( ) ;
186+ cache . DoMaintenance ( ) ;
187187 LogLru ( ) ;
188188
189189 cache . TryGet ( 16 , out var value1 ) . Should ( ) . BeTrue ( ) ;
@@ -199,12 +199,12 @@ public void WritePromotesProbation()
199199 }
200200
201201 // W [19] Protected [] Probation [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]
202- cache . PendingMaintenance ( ) ;
202+ cache . DoMaintenance ( ) ;
203203 LogLru ( ) ;
204204
205205 // W [24] Protected [16] Probation [2,6,7,8,9,10,11,12,13,14,15,17,18,19,20,21,22,23]
206206 cache . TryUpdate ( 16 , - 16 ) . Should ( ) . BeTrue ( ) ;
207- cache . PendingMaintenance ( ) ;
207+ cache . DoMaintenance ( ) ;
208208 LogLru ( ) ;
209209
210210 for ( int i = 25 ; i < 50 ; i ++ )
@@ -214,13 +214,13 @@ public void WritePromotesProbation()
214214 }
215215
216216 // W [49] Protected [16] Probation [2,6,7,8,9,10,11,12,13,14,15,17,18,19,20,21,22,23]
217- cache . PendingMaintenance ( ) ;
217+ cache . DoMaintenance ( ) ;
218218 LogLru ( ) ;
219219
220220 cache . Trim ( 18 ) ;
221221
222222 // W [49] Protected [16] Probation []
223- cache . PendingMaintenance ( ) ;
223+ cache . DoMaintenance ( ) ;
224224 LogLru ( ) ;
225225
226226 cache . TryGet ( 16 , out var value1 ) . Should ( ) . BeTrue ( ) ;
@@ -235,27 +235,27 @@ public void ReadUpdatesProtectedLruOrder()
235235 cache . GetOrAdd ( i , k => k ) ;
236236 }
237237
238- cache . PendingMaintenance ( ) ;
238+ cache . DoMaintenance ( ) ;
239239 LogLru ( ) ;
240240
241241 cache . GetOrAdd ( 7 , k => k ) ;
242242 cache . GetOrAdd ( 8 , k => k ) ;
243243 cache . GetOrAdd ( 9 , k => k ) ;
244244
245245 // W [19] Protected [7,8,9] Probation [0,1,2,3,4,5,6,10,11,12,13,14,15,16,17,18]
246- cache . PendingMaintenance ( ) ;
246+ cache . DoMaintenance ( ) ;
247247 LogLru ( ) ;
248248
249249 // W [19] Protected [8,9,7] Probation [0,1,2,3,4,5,6,10,11,12,13,14,15,16,17,18]
250250 // element 7 now moved to back of LRU
251251 cache . GetOrAdd ( 7 , k => k ) ;
252- cache . PendingMaintenance ( ) ;
252+ cache . DoMaintenance ( ) ;
253253 LogLru ( ) ;
254254
255255 // Trim is LRU order
256256 //W [19] Protected [7] Probation []
257257 cache . Trim ( 18 ) ;
258- cache . PendingMaintenance ( ) ;
258+ cache . DoMaintenance ( ) ;
259259 LogLru ( ) ;
260260
261261 cache . TryGet ( 7 , out var _ ) . Should ( ) . BeTrue ( ) ;
@@ -270,27 +270,27 @@ public void WriteUpdatesProtectedLruOrder()
270270 cache . GetOrAdd ( i , k => k ) ;
271271 }
272272
273- cache . PendingMaintenance ( ) ;
273+ cache . DoMaintenance ( ) ;
274274 LogLru ( ) ;
275275
276276 cache . GetOrAdd ( 7 , k => k ) ;
277277 cache . GetOrAdd ( 8 , k => k ) ;
278278 cache . GetOrAdd ( 9 , k => k ) ;
279279
280280 // W [19] Protected [7,8,9] Probation [0,1,2,3,4,5,6,10,11,12,13,14,15,16,17,18]
281- cache . PendingMaintenance ( ) ;
281+ cache . DoMaintenance ( ) ;
282282 LogLru ( ) ;
283283
284284 // W [19] Protected [8,9,7] Probation [0,1,2,3,4,5,6,10,11,12,13,14,15,16,17,18]
285285 // element 7 now moved to back of LRU
286286 cache . TryUpdate ( 7 , - 7 ) . Should ( ) . BeTrue ( ) ;
287- cache . PendingMaintenance ( ) ;
287+ cache . DoMaintenance ( ) ;
288288 LogLru ( ) ;
289289
290290 // Trim is LRU order
291291 //W [19] Protected [7] Probation []
292292 cache . Trim ( 18 ) ;
293- cache . PendingMaintenance ( ) ;
293+ cache . DoMaintenance ( ) ;
294294 LogLru ( ) ;
295295
296296 cache . TryGet ( 7 , out var _ ) . Should ( ) . BeTrue ( ) ;
@@ -308,7 +308,7 @@ public void WhenHitRateChangesWindowSizeIsAdapted()
308308 }
309309
310310 // W [19] Protected [] Probation [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]
311- cache . PendingMaintenance ( ) ;
311+ cache . DoMaintenance ( ) ;
312312 LogLru ( ) ;
313313
314314 for ( int i = 0 ; i < 15 ; i ++ )
@@ -317,7 +317,7 @@ public void WhenHitRateChangesWindowSizeIsAdapted()
317317 }
318318
319319 // W [19] Protected [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14] Probation [15,16,17,18]
320- cache . PendingMaintenance ( ) ;
320+ cache . DoMaintenance ( ) ;
321321 LogLru ( ) ;
322322
323323 // The reset sample size is 200, so do 200 cache hits
@@ -328,7 +328,7 @@ public void WhenHitRateChangesWindowSizeIsAdapted()
328328 cache . GetOrAdd ( i , k => k ) ;
329329 }
330330
331- cache . PendingMaintenance ( ) ;
331+ cache . DoMaintenance ( ) ;
332332 LogLru ( ) ;
333333
334334 // then miss 200 times
@@ -338,7 +338,7 @@ public void WhenHitRateChangesWindowSizeIsAdapted()
338338 cache . GetOrAdd ( i + 100 , k => k ) ;
339339 }
340340
341- cache . PendingMaintenance ( ) ;
341+ cache . DoMaintenance ( ) ;
342342 LogLru ( ) ;
343343
344344 // then miss 200 more times (window adaptation +1 window slots)
@@ -348,14 +348,14 @@ public void WhenHitRateChangesWindowSizeIsAdapted()
348348 cache . GetOrAdd ( i + 200 , k => k ) ;
349349 }
350350
351- cache . PendingMaintenance ( ) ;
351+ cache . DoMaintenance ( ) ;
352352 LogLru ( ) ;
353353
354354 // make 2 requests to new keys, if window is size is now 2 both will exist:
355355 cache . GetOrAdd ( 666 , k => k ) ;
356356 cache . GetOrAdd ( 667 , k => k ) ;
357357
358- cache . PendingMaintenance ( ) ;
358+ cache . DoMaintenance ( ) ;
359359 LogLru ( ) ;
360360
361361 cache . TryGet ( 666 , out var _ ) . Should ( ) . BeTrue ( ) ;
@@ -372,7 +372,7 @@ public void ReadSchedulesMaintenanceWhenBufferIsFull()
372372
373373 cache . GetOrAdd ( 1 , k => k ) ;
374374 scheduler . RunCount . Should ( ) . Be ( 1 ) ;
375- cache . PendingMaintenance ( ) ;
375+ cache . DoMaintenance ( ) ;
376376
377377 for ( int i = 0 ; i < ConcurrentLfu < int , int > . DefaultBufferSize ; i ++ )
378378 {
@@ -393,14 +393,14 @@ public void WhenReadBufferIsFullReadsAreDropped()
393393
394394 cache . GetOrAdd ( 1 , k => k ) ;
395395 scheduler . RunCount . Should ( ) . Be ( 1 ) ;
396- cache . PendingMaintenance ( ) ;
396+ cache . DoMaintenance ( ) ;
397397
398398 for ( int i = 0 ; i < ConcurrentLfu < int , int > . DefaultBufferSize * 2 ; i ++ )
399399 {
400400 cache . GetOrAdd ( 1 , k => k ) ;
401401 }
402402
403- cache . PendingMaintenance ( ) ;
403+ cache . DoMaintenance ( ) ;
404404
405405 cache . Metrics . Value . Hits . Should ( ) . Be ( ConcurrentLfu < int , int > . DefaultBufferSize ) ;
406406 }
@@ -415,7 +415,7 @@ public void WhenWriteBufferIsFullAddDoesMaintenance()
415415
416416 // add an item, flush write buffer
417417 cache . GetOrAdd ( - 1 , k => k ) ;
418- cache . PendingMaintenance ( ) ;
418+ cache . DoMaintenance ( ) ;
419419
420420 // remove the item but don't flush, it is now in the write buffer and maintenance is scheduled
421421 cache . TryRemove ( - 1 ) . Should ( ) . BeTrue ( ) ;
@@ -442,14 +442,14 @@ public void WhenWriteBufferIsFullUpdatesAreDropped()
442442
443443 cache . GetOrAdd ( 1 , k => k ) ;
444444 scheduler . RunCount . Should ( ) . Be ( 1 ) ;
445- cache . PendingMaintenance ( ) ;
445+ cache . DoMaintenance ( ) ;
446446
447447 for ( int i = 0 ; i < bufferSize * 2 ; i ++ )
448448 {
449449 cache . TryUpdate ( 1 , i ) ;
450450 }
451451
452- cache . PendingMaintenance ( ) ;
452+ cache . DoMaintenance ( ) ;
453453
454454 cache . Metrics . Value . Updated . Should ( ) . Be ( bufferSize ) ;
455455 }
@@ -484,7 +484,7 @@ public void WhenItemIsAddedThenRetrievedMetricHitRatioIsHalf()
484484 cache . GetOrAdd ( 1 , k => k ) ;
485485 bool result = cache . TryGet ( 1 , out var value ) ;
486486
487- cache . PendingMaintenance ( ) ;
487+ cache . DoMaintenance ( ) ;
488488
489489 cache . Metrics . Value . HitRatio . Should ( ) . Be ( 0.5 ) ;
490490 cache . Metrics . Value . Hits . Should ( ) . Be ( 1 ) ;
@@ -504,7 +504,7 @@ public void WhenItemIsEvictedMetricRecordsCount()
504504 cache . GetOrAdd ( i , k => k ) ;
505505 }
506506
507- cache . PendingMaintenance ( ) ;
507+ cache . DoMaintenance ( ) ;
508508
509509 cache . Metrics . Value . Evicted . Should ( ) . Be ( 5 ) ;
510510 }
@@ -576,7 +576,7 @@ public void WhenItemIsRemovedItIsDisposed()
576576 dcache . GetOrAdd ( 1 , k => disposable ) ;
577577
578578 dcache . TryRemove ( 1 ) . Should ( ) . BeTrue ( ) ;
579- dcache . PendingMaintenance ( ) ;
579+ dcache . DoMaintenance ( ) ;
580580
581581 disposable . IsDisposed . Should ( ) . BeTrue ( ) ;
582582 }
@@ -587,7 +587,7 @@ public void WhenItemIsRemovedEvictionCountIsIncremented()
587587 cache . GetOrAdd ( 1 , k => k ) ;
588588
589589 cache . TryRemove ( 1 ) . Should ( ) . BeTrue ( ) ;
590- cache . PendingMaintenance ( ) ;
590+ cache . DoMaintenance ( ) ;
591591
592592 cache . Metrics . Value . Evicted . Should ( ) . Be ( 1 ) ;
593593 }
@@ -605,15 +605,15 @@ public void WhenRemovedInWriteBuffer()
605605 cache . GetOrAdd ( 1 , k => k ) ;
606606
607607 // wait for the maintenance thread to run, this will attach the new node to the LRU list
608- cache . PendingMaintenance ( ) ;
608+ cache . DoMaintenance ( ) ;
609609
610610 // pending write in the buffer
611611 cache . TryUpdate ( 1 , 2 ) ;
612612
613613 // immediately remove
614614 cache . TryRemove ( 1 ) . Should ( ) . BeTrue ( ) ;
615615
616- cache . PendingMaintenance ( ) ;
616+ cache . DoMaintenance ( ) ;
617617
618618 cache . TryGet ( 1 , out var _ ) . Should ( ) . BeFalse ( ) ;
619619 }
@@ -629,10 +629,10 @@ public void WhenClearedCacheIsEmpty()
629629 {
630630 cache . GetOrAdd ( 1 , k => k ) ;
631631 cache . GetOrAdd ( 2 , k => k ) ;
632- cache . PendingMaintenance ( ) ;
632+ cache . DoMaintenance ( ) ;
633633
634634 cache . Clear ( ) ;
635- cache . PendingMaintenance ( ) ;
635+ cache . DoMaintenance ( ) ;
636636
637637 cache . Count . Should ( ) . Be ( 0 ) ;
638638 cache . TryGet ( 1 , out var _ ) . Should ( ) . BeFalse ( ) ;
@@ -645,12 +645,12 @@ public void TrimRemovesNItems()
645645 {
646646 cache . GetOrAdd ( i , k => k ) ;
647647 }
648- cache . PendingMaintenance ( ) ;
648+ cache . DoMaintenance ( ) ;
649649
650650 cache . Count . Should ( ) . Be ( 20 ) ;
651651
652652 cache . Trim ( 5 ) ;
653- cache . PendingMaintenance ( ) ;
653+ cache . DoMaintenance ( ) ;
654654
655655 cache . Count . Should ( ) . Be ( 15 ) ;
656656 }
@@ -669,7 +669,7 @@ public void TrimWhileItemsInWriteBufferRemovesNItems()
669669 // Trim implicitly performs maintenance
670670 cache . Trim ( 5 ) ;
671671
672- cache . PendingMaintenance ( ) ;
672+ cache . DoMaintenance ( ) ;
673673
674674 // The trim takes effect before all the writes are replayed by the maintenance thread.
675675 cache . Metrics . Value . Evicted . Should ( ) . Be ( 10 ) ;
@@ -747,7 +747,7 @@ public void VerifyMisses()
747747
748748 var end = Stopwatch . GetTimestamp ( ) ;
749749
750- cache . PendingMaintenance ( ) ;
750+ cache . DoMaintenance ( ) ;
751751
752752 var totalTicks = end - start ;
753753 var timeMs = ( ( double ) totalTicks / Stopwatch . Frequency ) * 1000.0 ;
0 commit comments