Latest web development tutorials

Redis comando Sunionstore

Redis conjunto (Set)

Redis Sunionstore dado conjunto de comandos y se almacena en la colección especificada establecido en el destino. Si el destino ya existe, será sobrescrito.

gramática

Redis Sunionstore sintaxis del comando básico es el siguiente:

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

versiones disponibles

> = 1.0.0

Valor de retorno

El número de elementos en el conjunto de resultados.

Ejemplos

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)