@@ -193,7 +193,7 @@ thread#0: _current_cost after decrease: 1
193
193
thread#0: }
194
194
thread#0: lru_cache::increaseCost(1) {
195
195
thread#0: _current_cost after increase: 2
196
- thread#0: lru_cache::dropLast () {
196
+ thread#0: lru_cache::dropLRU () {
197
197
thread#0: evicting entry with key: 3
198
198
thread#0: lru_cache::decreaseCost(1) {
199
199
thread#0: _current_cost after decrease: 1
@@ -361,13 +361,13 @@ R"(thread#0: ConcurrentCache::setMaxCost(500) {
361
361
thread#0: entered synchronized section
362
362
thread#0: lru_cache::increaseCost(0) {
363
363
thread#0: _current_cost after increase: 900
364
- thread#0: lru_cache::dropLast () {
364
+ thread#0: lru_cache::dropLRU () {
365
365
thread#0: evicting entry with key: 5
366
366
thread#0: lru_cache::decreaseCost(150) {
367
367
thread#0: _current_cost after decrease: 750
368
368
thread#0: }
369
369
thread#0: }
370
- thread#0: lru_cache::dropLast () {
370
+ thread#0: lru_cache::dropLRU () {
371
371
thread#0: evicting entry with key: 10
372
372
thread#0: lru_cache::decreaseCost(300) {
373
373
thread#0: _current_cost after decrease: 450
@@ -393,19 +393,19 @@ R"(thread#0: ConcurrentCache::setMaxCost(400) {
393
393
thread#0: entered synchronized section
394
394
thread#0: lru_cache::increaseCost(0) {
395
395
thread#0: _current_cost after increase: 900
396
- thread#0: lru_cache::dropLast () {
396
+ thread#0: lru_cache::dropLRU () {
397
397
thread#0: evicting entry with key: 5
398
398
thread#0: lru_cache::decreaseCost(150) {
399
399
thread#0: _current_cost after decrease: 750
400
400
thread#0: }
401
401
thread#0: }
402
- thread#0: lru_cache::dropLast () {
402
+ thread#0: lru_cache::dropLRU () {
403
403
thread#0: evicting entry with key: 10
404
404
thread#0: lru_cache::decreaseCost(300) {
405
405
thread#0: _current_cost after decrease: 450
406
406
thread#0: }
407
407
thread#0: }
408
- thread#0: lru_cache::dropLast () {
408
+ thread#0: lru_cache::dropLRU () {
409
409
thread#0: evicting entry with key: 15
410
410
thread#0: lru_cache::decreaseCost(450) {
411
411
thread#0: _current_cost after decrease: 0
@@ -625,13 +625,7 @@ s : It was a cache miss. Going to obtain the value...
625
625
f: }
626
626
f: lru_cache::increaseCost(60) {
627
627
f: _current_cost after increase: 210
628
- f: lru_cache::dropLast() {
629
- f: evicting entry with key: 6
630
- f: lru_cache::decreaseCost(0) {
631
- f: _current_cost after decrease: 210
632
- f: }
633
- f: }
634
- f: lru_cache::dropLast() {
628
+ f: lru_cache::dropLRU() {
635
629
f: evicting entry with key: 5
636
630
f: lru_cache::decreaseCost(150) {
637
631
f: _current_cost after decrease: 60
@@ -649,20 +643,15 @@ s : It was a cache miss. Going to obtain the value...
649
643
x : ConcurrentCache::getCacheSlot(6) {
650
644
x : entered synchronized section
651
645
x : lru_cache::getOrPut(6) {
652
- x : not in cache, adding...
653
- x : lru_cache::putMissing(6) {
654
- x : lru_cache::increaseCost(0) {
655
- x : _current_cost after increase: 60
656
- x : settled _current_cost: 60
657
- x : }
658
- x : }
646
+ x : already in cache, moved to the beginning of the LRU list.
659
647
x : }
660
648
x : exiting synchronized section
661
649
x : }
662
650
x : Obtained the cache slot
663
- x : It was a cache miss. Going to obtain the value ...
651
+ x : Waiting for result ...
664
652
s : Value was successfully obtained.
665
653
s : Made the value available for concurrent access.
654
+ x : } (return value: 60)
666
655
s : Computing the cost of the new entry...
667
656
s : cost=180
668
657
s : ConcurrentCache::finalizeCacheMiss(6) {
@@ -673,7 +662,7 @@ s : _current_cost after decrease: 60
673
662
s : }
674
663
s : lru_cache::increaseCost(180) {
675
664
s : _current_cost after increase: 240
676
- s : lru_cache::dropLast () {
665
+ s : lru_cache::dropLRU () {
677
666
s : evicting entry with key: 2
678
667
s : lru_cache::decreaseCost(60) {
679
668
s : _current_cost after decrease: 180
@@ -687,26 +676,6 @@ s : }
687
676
s : Done. Cache cost is at 180
688
677
s : Returning immediately...
689
678
s : } (return value: 60)
690
- x : Value was successfully obtained.
691
- x : Made the value available for concurrent access.
692
- x : Computing the cost of the new entry...
693
- x : cost=180
694
- x : ConcurrentCache::finalizeCacheMiss(6) {
695
- x : entered synchronized section
696
- x : lru_cache::put(6) {
697
- x : lru_cache::decreaseCost(180) {
698
- x : _current_cost after decrease: 0
699
- x : }
700
- x : lru_cache::increaseCost(180) {
701
- x : _current_cost after increase: 180
702
- x : settled _current_cost: 180
703
- x : }
704
- x : }
705
- x : exiting synchronized section
706
- x : }
707
- x : Done. Cache cost is at 180
708
- x : Returning immediately...
709
- x : } (return value: 60)
710
679
)" ;
711
680
712
681
zim::ConcurrentCache<int , size_t , CostAs3xValue> cache (200 );
0 commit comments