X-Git-Url: http://git.rot13.org/?p=perl-Redis.git;a=blobdiff_plain;f=lib%2FRedis.pm;h=952b80bb12f594621174f9296807a6a368eb1205;hp=d03416e779b8d47ffccdae1ac0740d099cda1890;hb=034e1cea13802c977bd220d8e393c4091d3a99bf;hpb=a57e5b0908eea8c9a2dbd0c0a0a36729afa5fc58 diff --git a/lib/Redis.pm b/lib/Redis.pm index d03416e..952b80b 100644 --- a/lib/Redis.pm +++ b/lib/Redis.pm @@ -112,7 +112,24 @@ sub get { return $v; } +=head2 incr + $r->incr('counter'); + $r->incr('tripplets', 3); + +=cut + +sub incr { + my ( $self, $key, $value ) = @_; + if ( defined $value ) { + print $sock "INCRBY $key $value\r\n"; + } else { + print $sock "INCR $key\r\n"; + } + my $count = <$sock>; + warn "# $key = $count"; + return $count; +} =head1 AUTHOR