Latest web development tutorials

comando Redis Sunionstore

Redis conjunto (Set)

Redis Sunionstore determinado conjunto de comandos e armazenados na coleção especificada definida no destino. Se o destino já existir, ele será substituído.

gramática

Redis Sunionstore sintaxe de comando básica é a seguinte:

redis 127.0.0.1:6379> SUNIONSTORE DESTINATION KEY KEY1..KEYN

versões disponíveis

> = 1.0.0

Valor de retorno

O número de elementos no conjunto de resultados.

Exemplos

redis 127.0.0.1:6379> SADD myset1 "hello"
(integer) 1
redis 127.0.0.1:6379> SADD myset1 "world"
(integer) 1
redis 127.0.0.1:6379> SADD myset1 "bar"
(integer) 1
redis 127.0.0.1:6379> SADD myset2 "hello"
(integer) 1
redis 127.0.0.1:6379> SADD myset2 "bar"
(integer) 1
redis 127.0.0.1:6379> SUNIONSTORE myset myset1 myset2
(integer) 1
redis 127.0.0.1:6379> SMEMBERS myset
1) "bar"
2) "world"
3) "hello"
4) "foo"

Redis conjunto (Set)