MCE::Shared::Hash - Hash helper class
This document describes MCE::Shared::Hash version 1.699_007
# non-shared use MCE::Shared::Hash; my $ha = MCE::Shared::Hash->new( @pairs ); # shared use MCE::Shared; my $ha = MCE::Shared->hash( @pairs ); # oo interface $val = $ha->set( $key, $val ); $val = $ha->get( $key ); $val = $ha->delete( $key ); $bool = $ha->exists( $key ); void = $ha->clear(); $len = $ha->length(); # scalar keys %{ $ha } $len = $ha->length( $key ); # length $ha->{ $key } $ha2 = $ha->clone( @keys ); # @keys is optional $ha3 = $ha->flush( @keys ); $iter = $ha->iterator( @keys ); # ($key, $val) = $iter->() $len = $ha->merge( $key/$val pairs ); @vals = $ha->mget( @keys ); @keys = $ha->keys( @keys ); @vals = $ha->values( @keys ); %pairs = $ha->pairs( @keys ); %pairs = $ha->find( "val =~ /$pattern/i" ); %pairs = $ha->find( "val !~ /$pattern/i" ); %pairs = $ha->find( "key =~ /$pattern/i" ); %pairs = $ha->find( "key !~ /$pattern/i" ); %pairs = $ha->find( "val eq $string" ); # also, find( "key ..." ) %pairs = $ha->find( "val ne $string" ); %pairs = $ha->find( "val lt $string" ); %pairs = $ha->find( "val le $string" ); %pairs = $ha->find( "val gt $string" ); %pairs = $ha->find( "val ge $string" ); %pairs = $ha->find( "val == $number" ); # ditto, find( "key ..." ) %pairs = $ha->find( "val != $number" ); %pairs = $ha->find( "val < $number" ); %pairs = $ha->find( "val <= $number" ); %pairs = $ha->find( "val > $number" ); %pairs = $ha->find( "val >= $number" ); # sugar methods without having to call set/get explicitly $len = $ha->append( $key, $string ); # $val .= $string $val = $ha->decr( $key ); # --$val $val = $ha->decrby( $key, $number ); # $val -= $number $val = $ha->incr( $key ); # ++$val $val = $ha->incrby( $key, $number ); # $val += $number $val = $ha->pdecr( $key ); # $val-- $val = $ha->pincr( $key ); # $val++
Helper class for MCE::Shared.
To be completed before the final 1.700 release.
Implementation inspired by Tie::StdHash.
MCE, MCE::Core, MCE::Shared
Mario E. Roy, <marioeroy AT gmail DOT com>
To install MCE, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MCE
CPAN shell
perl -MCPAN -e shell install MCE
For more information on module installation, please visit the detailed CPAN module installation guide.