SMOVE to move a member from one set to another atomically.
The reply is 1 when the member was moved and 0 when it was not in the source set, in which case nothing changes. If the member already exists in the destination it is simply removed from the source. The destination is created when it does not exist, and the source is deleted when its last member leaves.
Because the removal and the insertion happen as one step, this is the safe way to move an item between states, such as from a pending set to a done set, without a window in which it is in both or in neither.
Syntax
Arguments
Response
The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.
Examples
TCP examples use the TLSREDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.
Redis CLI
Redis CLI
@upstash/redis
@upstash/redis
upstash_redis
upstash_redis
ioredis
ioredis
node-redis
node-redis
redis-py
redis-py
go-redis
go-redis
jedis
jedis
redis-rs
redis-rs