AptlyStar

Redis

Key-value operations with Redis

Instrucciones de uso

Connect to any Redis instance to perform key-value, hash, list, and utility operations via a direct connection.

Herramientas

redis_get

Get the value of a key from Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe key to retrieve

Salida

ParámetroTipoDescripción
keystringThe key that was retrieved
valuestringThe value of the key, or null if the key does not exist

redis_set

Set the value of a key in Redis with an optional expiration time in seconds.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe key to set
valuestringSíThe value to store
exnumberNoExpiration time in seconds (optional)

Salida

ParámetroTipoDescripción
keystringThe key that was set
resultstringThe result of the SET operation (typically "OK")

redis_delete

Delete a key from Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe key to delete

Salida

ParámetroTipoDescripción
keystringThe key that was deleted
deletedCountnumberNumber of keys deleted (0 if key did not exist, 1 if deleted)

redis_keys

List all keys matching a pattern in Redis. Avoid using on large databases in production; use the Redis Command tool with SCAN for large key spaces.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
patternstringNoPattern to match keys (default: * for all keys)

Salida

ParámetroTipoDescripción
patternstringThe pattern used to match keys
keysarrayList of keys matching the pattern
countnumberNumber of keys found

redis_command

Execute a raw Redis command as a JSON array (e.g. [

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
commandstringSíRedis command as a JSON array (e.g. ["SET", "key", "value"])

Salida

ParámetroTipoDescripción
commandstringThe command that was executed
resultjsonThe result of the command

redis_hset

Set a field in a hash stored at a key in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe hash key
fieldstringSíThe field name within the hash
valuestringSíThe value to set for the field

Salida

ParámetroTipoDescripción
keystringThe hash key
fieldstringThe field that was set
resultnumberNumber of fields added (1 if new, 0 if updated)

redis_hget

Get the value of a field in a hash stored at a key in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe hash key
fieldstringSíThe field name to retrieve

Salida

ParámetroTipoDescripción
keystringThe hash key
fieldstringThe field that was retrieved
valuestringThe field value, or null if the field or key does not exist

redis_hgetall

Get all fields and values of a hash stored at a key in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe hash key

Salida

ParámetroTipoDescripción
keystringThe hash key
fieldsobjectAll field-value pairs in the hash as a key-value object. Empty object if the key does not exist.
fieldCountnumberNumber of fields in the hash

redis_hdel

Delete a field from a hash stored at a key in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe hash key
fieldstringSíThe field name to delete

Salida

ParámetroTipoDescripción
keystringThe hash key
fieldstringThe field that was deleted
deletednumberNumber of fields removed (1 if deleted, 0 if field did not exist)

redis_incr

Increment the integer value of a key by one in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe key to increment

Salida

ParámetroTipoDescripción
keystringThe key that was incremented
valuenumberThe new value after increment

redis_incrby

Increment the integer value of a key by a given amount in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe key to increment
incrementnumberSíAmount to increment by (negative to decrement)

Salida

ParámetroTipoDescripción
keystringThe key that was incremented
valuenumberThe new value after increment

redis_expire

Set an expiration time (in seconds) on a key in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe key to set expiration on
secondsnumberSíTimeout in seconds

Salida

ParámetroTipoDescripción
keystringThe key that expiration was set on
resultnumber1 if the timeout was set, 0 if the key does not exist

redis_ttl

Get the remaining time to live (in seconds) of a key in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe key to check TTL for

Salida

ParámetroTipoDescripción
keystringThe key that was checked
ttlnumberRemaining TTL in seconds. Positive integer if TTL set, -1 if no expiration, -2 if key does not exist.

redis_persist

Remove the expiration from a key in Redis, making it persist indefinitely.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe key to persist

Salida

ParámetroTipoDescripción
keystringThe key that was persisted
resultnumber1 if the expiration was removed, 0 if the key does not exist or has no expiration

redis_lpush

Prepend a value to a list stored at a key in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe list key
valuestringSíThe value to prepend

Salida

ParámetroTipoDescripción
keystringThe list key
lengthnumberLength of the list after the push

redis_rpush

Append a value to the end of a list stored at a key in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe list key
valuestringSíThe value to append

Salida

ParámetroTipoDescripción
keystringThe list key
lengthnumberLength of the list after the push

redis_lpop

Remove and return the first element of a list stored at a key in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe list key

Salida

ParámetroTipoDescripción
keystringThe list key
valuestringThe removed element, or null if the list is empty

redis_rpop

Remove and return the last element of a list stored at a key in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe list key

Salida

ParámetroTipoDescripción
keystringThe list key
valuestringThe removed element, or null if the list is empty

redis_llen

Get the length of a list stored at a key in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe list key

Salida

ParámetroTipoDescripción
keystringThe list key
lengthnumberThe length of the list, or 0 if the key does not exist

redis_lrange

Get a range of elements from a list stored at a key in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe list key
startnumberSíStart index (0-based)
stopnumberSíStop index (-1 for all elements)

Salida

ParámetroTipoDescripción
keystringThe list key
valuesarrayList elements in the specified range
countnumberNumber of elements returned

redis_exists

Check if a key exists in Redis.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe key to check

Salida

ParámetroTipoDescripción
keystringThe key that was checked
existsbooleanWhether the key exists (true) or not (false)

redis_setnx

Set the value of a key in Redis only if the key does not already exist.

Entrada

ParámetroTipoObligatorioDescripción
urlstringSíRedis connection URL (e.g. redis://user:password@host:port)
keystringSíThe key to set
valuestringSíThe value to store

Salida

ParámetroTipoDescripción
keystringThe key that was set
wasSetbooleanWhether the key was set (true) or already existed (false)

On this page