p5-RedisDB / RedisDB

Perl extension to access Redis
22 stars 11 forks source link

Strange behavior with transaction #5

Closed vovpov closed 12 years ago

vovpov commented 12 years ago

Hello. I see strange behavior when work with transaction as follows:

Example:

my $listName = 'testList'; $redis->multi() $redis->lrange($listName,0,-1); # read all list entires $redis->ltrim($listName,1,0); # clear list my $res = $redis->exec();

The $res must have next structure: [ [ # result for LRANGE command item, item, ... ], OK # result for LTRIM command ] And this is true if the list exists and contains at least one element. But when list is empty or not exist the exec() method return empty list -> [], and next command executed with this redis instance return the 'OK' - so it seems that RedisDB did not properly handle last "multi-answer" from redis server.

vovpov commented 12 years ago

Sorry forgot to say Redis server version 2.4.5 (00000000:0) RedisDB is 0.26

trinitum commented 12 years ago

I see the problem, I will upload fix this evening. Thanks for your report.