一个简单的S3-FIFO缓存实现
let mut cache: Cache<String, i32> = Cache::with_options(
OptionsBuilder::new()
.estimated_capacity(10)
.build()
.unwrap(),
);
cache.insert("key1".to_string(), 100);
println!("key1: {:?}", cache.get(&"key1".to_string()));Async runtime: Tokio
Config { trace_file: Oltp, ttl: None, tti: None, num_clients: Some([1, 3, 6]), repeat: None, insertion_delay: None, insert_once: false, invalidate: false, invalidate_all: false, invalidate_entries_if: false, iterate: false, eviction_listener: None, size_aware: false, entry_api: false, per_key_expiration: false }
Cache, Max Capacity, Clients, Inserts, Reads, Hit Ratio, Duration Secs
QuickCache Sync Cache, 256, 1, 737527, 914145, 19.321, 0.137
QuickCache Sync Cache, 256, 3, 727498, 914145, 20.418, 0.127
QuickCache Sync Cache, 256, 6, 717391, 914145, 21.523, 0.171
TinyUFO, 256, 1, 789274, 914145, 13.660, 0.384
TinyUFO, 256, 3, 781574, 914145, 14.502, 0.367
TinyUFO, 256, 6, 771463, 914145, 15.608, 0.421
JustCache, 256, 1, 726377, 914145, 20.540, 0.112
JustCache, 256, 3, 730906, 914145, 20.045, 0.116
JustCache, 256, 6, 727012, 914145, 20.471, 0.132
Moka Sync Cache, 256, 1, 703040, 914145, 23.093, 0.601
Moka Sync Cache, 256, 3, 645454, 914145, 29.393, 0.611
Moka Sync Cache, 256, 6, 645922, 914145, 29.341, 0.541
Moka Async Cache, 256, 1, 703040, 914145, 23.093, 0.732
Moka Async Cache, 256, 3, 702121, 914145, 23.194, 0.770
Moka Async Cache, 256, 6, 662686, 914145, 27.508, 0.600
Moka SegmentedCache(8), 256, 1, 621315, 914145, 32.033, 0.572
Moka SegmentedCache(8), 256, 3, 631267, 914145, 30.945, 0.550
Moka SegmentedCache(8), 256, 6, 644790, 914145, 29.465, 0.545
QuickCache Sync Cache, 512, 1, 658121, 914145, 28.007, 0.124
QuickCache Sync Cache, 512, 3, 662380, 914145, 27.541, 0.107
QuickCache Sync Cache, 512, 6, 657663, 914145, 28.057, 0.121
TinyUFO, 512, 1, 733147, 914145, 19.800, 0.359
TinyUFO, 512, 3, 736510, 914145, 19.432, 0.340
TinyUFO, 512, 6, 734135, 914145, 19.692, 0.406
JustCache, 512, 1, 651023, 914145, 28.783, 0.119
JustCache, 512, 3, 662121, 914145, 27.569, 0.110
JustCache, 512, 6, 662131, 914145, 27.568, 0.125
Moka Sync Cache, 512, 1, 640117, 914145, 29.976, 0.579
Moka Sync Cache, 512, 3, 596233, 914145, 34.777, 0.536
Moka Sync Cache, 512, 6, 590375, 914145, 35.418, 0.468
Moka Async Cache, 512, 1, 640117, 914145, 29.976, 0.699
Moka Async Cache, 512, 3, 640168, 914145, 29.971, 0.704
Moka Async Cache, 512, 6, 602537, 914145, 34.087, 0.516
Moka SegmentedCache(8), 512, 1, 579784, 914145, 36.576, 0.522
Moka SegmentedCache(8), 512, 3, 589731, 914145, 35.488, 0.489
Moka SegmentedCache(8), 512, 6, 601701, 914145, 34.179, 0.474
QuickCache Sync Cache, 1000, 1, 580981, 914145, 36.445, 0.115
QuickCache Sync Cache, 1000, 3, 590638, 914145, 35.389, 0.094
QuickCache Sync Cache, 1000, 6, 593117, 914145, 35.118, 0.114
TinyUFO, 1000, 1, 651247, 914145, 28.759, 0.326
TinyUFO, 1000, 3, 679778, 914145, 25.638, 0.312
TinyUFO, 1000, 6, 675262, 914145, 26.132, 0.377
JustCache, 1000, 1, 562502, 914145, 38.467, 0.123
JustCache, 1000, 3, 577563, 914145, 36.819, 0.100
JustCache, 1000, 6, 589279, 914145, 35.538, 0.119
Moka Sync Cache, 1000, 1, 586961, 914145, 35.791, 0.515
Moka Sync Cache, 1000, 3, 549937, 914145, 39.841, 0.539
Moka Sync Cache, 1000, 6, 543075, 914145, 40.592, 0.434
Moka Async Cache, 1000, 1, 586961, 914145, 35.791, 0.628
Moka Async Cache, 1000, 3, 586955, 914145, 35.792, 0.605
Moka Async Cache, 1000, 6, 552786, 914145, 39.530, 0.474
Moka SegmentedCache(8), 1000, 1, 544208, 914145, 40.468, 0.500
Moka SegmentedCache(8), 1000, 3, 553109, 914145, 39.494, 0.443
Moka SegmentedCache(8), 1000, 6, 563435, 914145, 38.365, 0.432
QuickCache Sync Cache, 2000, 1, 517615, 914145, 43.377, 0.111
QuickCache Sync Cache, 2000, 3, 529734, 914145, 42.051, 0.085
QuickCache Sync Cache, 2000, 6, 534277, 914145, 41.554, 0.096
TinyUFO, 2000, 1, 575193, 914145, 37.079, 0.297
TinyUFO, 2000, 3, 582106, 914145, 36.322, 0.264
TinyUFO, 2000, 6, 582700, 914145, 36.257, 0.322
JustCache, 2000, 1, 495107, 914145, 45.839, 0.120
JustCache, 2000, 3, 500038, 914145, 45.300, 0.091
JustCache, 2000, 6, 512517, 914145, 43.935, 0.104
Moka Sync Cache, 2000, 1, 537324, 914145, 41.221, 0.467
Moka Sync Cache, 2000, 3, 509694, 914145, 44.244, 0.420
Moka Sync Cache, 2000, 6, 500793, 914145, 45.217, 0.372
Moka Async Cache, 2000, 1, 537324, 914145, 41.221, 0.580
Moka Async Cache, 2000, 3, 537275, 914145, 41.227, 0.532
Moka Async Cache, 2000, 6, 509116, 914145, 44.307, 0.428
Moka SegmentedCache(8), 2000, 1, 498102, 914145, 45.512, 0.457
Moka SegmentedCache(8), 2000, 3, 506276, 914145, 44.618, 0.384
Moka SegmentedCache(8), 2000, 6, 515682, 914145, 43.589, 0.373