Tie::Array::QueueExpire

Tie an ARRAY over a TokyoCabinet Btree DB
Download

Tie::Array::QueueExpire Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Dulaunoy Fabrice
  • Publisher web site:
  • http://search.cpan.org/~fdulau/Tie-CountLoop-1.5/lib/Tie/CountLoop.pm

Tie::Array::QueueExpire Tags


Tie::Array::QueueExpire Description

Tie an ARRAY over a TokyoCabinet Btree DB Tie::Array::QueueExpire is a Perl module that requires Time::HiRes, TokyoCabinet (database and perl module.) The insertion is ms unique ( 0.001 seconds ). The normal ARRAY function present are push pop shift exits scalar clear unshift (but put data 1 second before the first entry)The following function is not completely iplemented. splice The following function are not implemented. extend store STORESIZEThe following function are specific of this module. LAST FIRST EXPIRE OPTIMIZE PUSH FETCHSYNOPSIS use Tie::Array::QueueExpire; my $t = tie( my @myarray, "Tie::Array::QueueExpire", '/tmp/db_test.bdb' ); push @myarray, int rand 1000; # normal ARRAY function my $data = shift @myarray; my $data = pop @myarray; print "this elem exists " if (exists( $myarray)); print "size = ". scalar( @myarray )." "; # using the PUSH with an extra parameter to put the new element in futur # also return the key of the inserted value for ( 1 .. 10 ) { say "t=".time.' '. int (($t->PUSH( $_ . ' ' . time, 10 ))/1000); sleep 1; } sleep 10; # Get the expired elements ( 7 seconds before now ) my $ex = $t->EXPIRE( 7 ); # Get the expired elements my @EXP = @{$t->EXPIRE($exp)}; # Get and delete the expired elements ( 20 seconds before now ) $ex = $t->EXPIRE(20,1); my @EXP = @{$t->EXPIRE($exp,1)}; # fetch element # in scalar context return the value # in array context return in first element the key and in second, the value my $a =$t->FETCH(6); my @b = $t->FETCH(6); # the normal array fetch is always in scalar mode my @c=$myarray; say Dumper( $a ); say Dumper( @b ); say Dumper( @c ); Requirements: · Perl


Tie::Array::QueueExpire Related Software