$ diff test-cache-lru.pl test-cache-mce.pl 1a2,3 > # based on test-cache-lru.pl > # https://github.com/celogeek/perl-test-caching/tree/master 8c10 < use Cache::LRU; --- > use MCE::Shared::Cache; 17c19 < my $c = Cache::LRU->new(size => 500000); --- > my $c = MCE::Shared::Cache->new(max_keys => 500000); #### $ diff test-cache-lru-with-expires.pl test-cache-mce-with-expires.pl 1a2,3 > # based on test-cache-lru-with-expires.pl > # https://github.com/celogeek/perl-test-caching/tree/master 8c10 < use Cache::LRU::WithExpires; --- > use MCE::Shared::Cache; 17c19 < my $c = Cache::LRU::WithExpires->new(size => 500000); --- > my $c = MCE::Shared::Cache->new(max_keys => 500000); #### $ perl test-cache-lru.pl Mapping Starting Write: 629454.032475913 Read : 1121841.10542643 Found: 500000 Mem : 436666368 $ perl test-cache-mce.pl Mapping Starting Write: 662199.102659472 Read : 1054666.70019362 Found: 500000 Mem : 254976000 #### $ perl test-cache-lru-with-expires.pl Mapping Starting Write: 478838.905524077 Read : 726818.987997266 Found: 500000 Mem : 525479936 $ perl test-cache-mce-with-expires.pl Mapping Starting Write: 605342.765771411 Read : 994375.492182959 Found: 500000 Mem : 254980096 #### $ diff demo-from-doc.pl test-cache-parallel-mce.pl 17c17 < my $c = MCE::Shared->cache( max_keys => 500_000 ); --- > my $c = MCE::Shared->cache(); 29c29 < for ( @{ $chunk_ref } ) { $c->set($_, {md5 => $_}) } --- > for ( @{ $chunk_ref } ) { $c->set($_, {md5 => $_}, 600) } #### $ diff test-cache-parallel-mce.pl test-cache-parallel-redis.pl 10a11,12 > use Redis; > use Sereal qw/encode_sereal decode_sereal/; 17c19 < my $c = MCE::Shared->cache(); --- > my $c = Redis->new; 29c31 < for ( @{ $chunk_ref } ) { $c->set($_, {md5 => $_}, 600) } --- > for ( @{ $chunk_ref } ) { $c->setex($_, 600, encode_sereal({md5 => $_})) } 33c35,39 < for ( @{ $chunk_ref } ) { $f++ if ref $c->get($_) eq 'HASH' } --- > for ( @{ $chunk_ref } ) { > my $srl = $c->get($_); > $srl = decode_sereal($srl) if defined $srl; > $f++ if ref $srl eq 'HASH'; > } #### $ perl test-cache-parallel-mce.pl Mapping Starting Write: 228731.311 Read : 143733.302 Found: 600000 $ perl test-cache-parallel-redis.pl Mapping Starting Write: 159626.727 Read : 164603.402 Found: 600000 $ perl test-redis-tcp.pl Mapping Starting Write: 57403.6057590594 Read : 60989.7109982115 Found: 600000 Mem : 270336