Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TYPE does not work with RedisArray previous option #207

Closed
@seansawyer

Description

@seansawyer

Similar to #206. RedisArray->type() erroneously reports Redis::REDIS_NOT_FOUND for keys that exist in a previous position and for which values can be fetched.

Key "test:{0}" is present in the Redis instance running at port 12003:

redis 127.0.0.1:12003> exists "test:{0}"
(integer) 1
redis 127.0.0.1:12003> type "test:{0}"
hash
redis 127.0.0.1:12003> hgetall "test:{0}"
1) "zero"
2) "0"
3) "one"
4) "1"
5) "two"
6) "2"

See where RedisArray thinks the key should go, and whether it can get it from where it used to hash to:

$ra = new RedisArray(array('localhost:12003', 'localhost:12004'), array('previous'=>array('localhost:12003')));
php > var_dump($ra->_target("test:{0}"));
string(15) "localhost:12004"
php > var_dump($ra->exists("test:{0}"));                                                                                                                                                                                                                                                                                      
bool(false)
php > var_dump($ra->type("test:{0}"));                                                                                                                                                                                                                                                                                        
int(0)
php > var_dump(Redis::REDIS_NOT_FOUND);                                                                                                                                                                                                                                                                                       
int(0)
php > var_dump($ra->hgetall("test:{0}"));                                                                                                                                                                                                                                                                                     
array(3) {
  ["zero"]=>
  string(1) "0"
  ["one"]=>
  string(1) "1"
  ["two"]=>
  string(1) "2"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions