The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MCE::Shared::Hash - Hash helper class

VERSION

This document describes MCE::Shared::Hash version 1.699_007

SYNOPSIS

   # 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++

DESCRIPTION

Helper class for MCE::Shared.

API DOCUMENTATION

To be completed before the final 1.700 release.

new
set
get
delete
exists
clear
length
clone
flush
iterator
mget
merge
keys
values
pairs
find
append
decr
decrby
incr
incrby
pdecr
pincr

CREDITS

Implementation inspired by Tie::StdHash.

INDEX

MCE, MCE::Core, MCE::Shared

AUTHOR

Mario E. Roy, <marioeroy AT gmail DOT com>