Skip to content

Redis hash commands (25/27 implemented)

HDEL

Deletes one or more fields and their values from a hash. Deletes the hash if no fields remain.

HEXISTS

Determines whether a field exists in a hash.

HEXPIRE

Set expiry for hash field using relative time to expire (seconds)

HEXPIREAT

Set expiry for hash field using an absolute Unix timestamp (seconds)

HEXPIRETIME

Returns the expiration time of a hash field as a Unix timestamp, in seconds.

HGET

Returns the value of a field in a hash.

HGETALL

Returns all fields and values in a hash.

HINCRBY

Increments the integer value of a field in a hash by a number. Uses 0 as initial value if the field doesn't exist.

HINCRBYFLOAT

Increments the floating point value of a field by a number. Uses 0 as initial value if the field doesn't exist.

HKEYS

Returns all fields in a hash.

HLEN

Returns the number of fields in a hash.

HMGET

Returns the values of all fields in a hash.

HMSET

Sets the values of multiple fields.

HPERSIST

Removes the expiration time for each specified field

HPEXPIRE

Set expiry for hash field using relative time to expire (milliseconds)

HPEXPIREAT

Set expiry for hash field using an absolute Unix timestamp (milliseconds)

HPEXPIRETIME

Returns the expiration time of a hash field as a Unix timestamp, in msec.

HPTTL

Returns the TTL in milliseconds of a hash field.

HRANDFIELD

Returns one or more random fields from a hash.

HSCAN

Iterates over fields and values of a hash.

HSET

Creates or modifies the value of a field in a hash.

HSETNX

Sets the value of a field in a hash only when the field doesn't exist.

HSTRLEN

Returns the length of the value of a field.

HTTL

Returns the TTL in seconds of a hash field.

HVALS

Returns all values in a hash.

Unsupported hash commands

To implement support for a command, see here

HGETF (not implemented)

For each specified field, returns its value and optionally set the field's remaining expiration time in seconds / milliseconds

HSETF (not implemented)

For each specified field, returns its value and optionally set the field's remaining expiration time in seconds / milliseconds