From 748f1216489a7007e21f1caa28499d46b3e5aadc Mon Sep 17 00:00:00 2001 From: Dirk Vleugels Date: Tue, 23 Mar 2010 18:10:36 +0100 Subject: [PATCH] uses only the multi-bulk protocol http://groups.google.com/group/redis-db/browse_thread/thread/4b266d0f6f11d9ba/adf47fd931f62787 --- lib/Redis.pm | 40 +++++----------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/lib/Redis.pm b/lib/Redis.pm index 55fd1a1..75bc088 100644 --- a/lib/Redis.pm +++ b/lib/Redis.pm @@ -55,22 +55,6 @@ sub new { $self; } -my $bulk_command = { - set => 1, setnx => 1, - rpush => 1, lpush => 1, - lset => 1, lrem => 1, - sadd => 1, srem => 1, - sismember => 1, - echo => 1, - getset => 1, - smove => 1, - zadd => 1, - zrem => 1, - zscore => 1, - zincrby => 1, - append => 1, -}; - # we don't want DESTROY to fallback into AUTOLOAD sub DESTROY {} @@ -87,27 +71,13 @@ sub AUTOLOAD { warn "## $command ",Dumper(@_) if $self->{debug}; - my $send; - - if ( defined $bulk_command->{$command} ) { - my $value = pop; - $value = '' if ! defined $value; - $send - = uc($command) - . ' ' - . join(' ', @_) - . ' ' - . length( $value ) - . "\r\n$value\r\n" - ; - } else { - $send - = uc($command) - . ' ' - . join(' ', @_) + unshift @_, uc($command); + + my $send + = "*".(scalar @_) . "\r\n" + . join("", map { "\$". length($_) ."\r\n". $_ ."\r\n" } @_) ; - } warn ">> $send" if $self->{debug}; print $sock $send; -- 2.20.1