LAVIK.HREPLACE

Atomically replaces all fields of an existing hash while preserving its key expiry.

Hashes · Example verified

Syntax covered here

LAVIK.HREPLACE key field value [field value ...]

Omitted fields are removed; a missing key returns null, and a live non-hash key raises WRONGTYPE. The absolute expiry is preserved, and Redis SDKs can invoke this Lavik extension through a raw command API.

Tested example & replies

Requests below run in order against an empty database. Each connection authenticates with the fixture password first. Quoted values are strings; null is a nil reply; arrays preserve RESP order.

# connection: default
> HSET user name Ada
1
# connection: default
> LAVIK.HREPLACE user city Paris
"OK"
# connection: default
> HGETALL user
["city","Paris"]
# connection: default
> LAVIK.HREPLACE missing field value
null
# connection: default
> SET text value
"OK"
# connection: default
> LAVIK.HREPLACE text field value
{"error":"WRONGTYPE Operation against a key holding the wrong kind of value"}
# connection: default
> PEXPIREAT user 4102444800000
1
# connection: default
> LAVIK.HREPLACE user city Rome
"OK"
# connection: default
> PEXPIRETIME user
4102444800000