++ed by:
POTATOGIM IOANR MOCNII EGOR EMAZEP

40 PAUSE users
34 non-PAUSE users.

Mario Roy
and 1 contributors

NAME

MCE::Shared::Ordhash - Class for sharing ordered hashes via MCE::Shared

VERSION

This document describes MCE::Shared::Ordhash version 1.699_002

SYNOPSIS

   # non-shared
   use MCE::Shared::Ordhash;

   my $oh = MCE::Shared::Ordhash->new( @pairs );

   # shared
   use MCE::Shared;

   my $oh = MCE::Shared->ordhash( @pairs );

   # oo interface
   $val   = $oh->set( $key, $val );
   $val   = $oh->get( $key );
   $val   = $oh->delete( $key );
   $bool  = $oh->exists( $key );
   void   = $oh->clear();
   $len   = $oh->length();                    # scalar keys %{ $oh }
   $len   = $oh->length( $key );              # length $oh->{ $key }
   @pair  = $oh->pop();
   $len   = $oh->push( @pairs );
   @pair  = $oh->shift();
   $len   = $oh->unshift( @pairs );
   %pairs = $oh->splice( $offset, $length, @pairs );

   $oh2   = $oh->clone( @keys );              # @keys is optional
   $oh3   = $oh->flush( @keys );
   $iter  = $oh->iterator( @keys );           # ($key, $val) = $iter->()
   $len   = $oh->mset( $key/$val pairs );
   @vals  = $oh->mget( @keys );
   @keys  = $oh->keys( @keys );
   @vals  = $oh->values( @keys );
   %pairs = $oh->pairs( @keys );

   @vals  = $oh->sort();                      # by val $a <=> $b default
   @vals  = $oh->sort( "desc" );              # by val $b <=> $a
   @vals  = $oh->sort( "alpha" );             # by val $a cmp $b
   @vals  = $oh->sort( "alpha desc" );        # by val $b cmp $a

   @vals  = $oh->sort( "key" );               # by key $a <=> $b
   @vals  = $oh->sort( "key desc" );          # by key $b <=> $a
   @vals  = $oh->sort( "key alpha" );         # by key $a cmp $b
   @vals  = $oh->sort( "key alpha desc" );    # by key $b cmp $a

   %pairs = $oh->find( "val =~ /$pattern/i" );
   %pairs = $oh->find( "val !~ /$pattern/i" );
   %pairs = $oh->find( "key =~ /$pattern/i" );
   %pairs = $oh->find( "key !~ /$pattern/i" );

   %pairs = $oh->find( "val eq $string" );    # also, search key
   %pairs = $oh->find( "val ne $string" );
   %pairs = $oh->find( "val lt $string" );
   %pairs = $oh->find( "val le $string" );
   %pairs = $oh->find( "val gt $string" );
   %pairs = $oh->find( "val ge $string" );

   %pairs = $oh->find( "val == $number" );    # ditto, find( "key ..." )
   %pairs = $oh->find( "val != $number" );
   %pairs = $oh->find( "val <  $number" );
   %pairs = $oh->find( "val <= $number" );
   %pairs = $oh->find( "val >  $number" );
   %pairs = $oh->find( "val >= $number" );

   # sugar methods without having to call set/get explicitly
   $len   = $oh->append( $key, $string );     #   $val .= $string
   $val   = $oh->decr( $key );                # --$val
   $val   = $oh->decrby( $key, $number );     #   $val -= $number
   $val   = $oh->incr( $key );                # ++$val
   $val   = $oh->incrby( $key, $number );     #   $val += $number
   $val   = $oh->pdecr( $key );               #   $val--
   $val   = $oh->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
pop
push
shift
unshift
splice
purge
clone
flush
iterator
mget
mset
keys
values
pairs
find
sort
append
decr
decrby
incr
incrby
pdecr
pincr

CREDITS

Implementation inspired by Hash::Ordered.

INDEX

MCE, MCE::Core, MCE::Shared

AUTHOR

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