Handles Redis generic key commands: TYPE, UNLINK, RENAME, RENAMENX, COPY, RANDOMKEY, SCAN, EXPIRETIME, PEXPIRETIME, OBJECT, WAIT.
These commands operate on keys regardless of value type. Each handler takes the uppercased command name, a list of string arguments, and an injected store map. Returns plain Elixir terms -- the connection layer handles RESP encoding.
Supported commands
TYPE key-- returns the type of key ("string" for existing, "none" for missing)UNLINK key [key ...]-- async DEL; returns count of deleted keysRENAME key newkey-- rename key, error if source missingRENAMENX key newkey-- rename only if newkey doesn't exist (1 = renamed, 0 = not)COPY source destination [REPLACE]-- copy value+TTL (1 = success, 0 = failure)RANDOMKEY-- return a random key, or nil if DB is emptySCAN cursor [MATCH pattern] [COUNT count] [TYPE type]-- cursor-based key iterationEXPIRETIME key-- absolute Unix timestamp (seconds) when key expires (-1 / -2)PEXPIRETIME key-- absolute Unix timestamp (milliseconds) when key expires (-1 / -2)OBJECT ENCODING key-- returns actual encoding based on key typeOBJECT HELP-- returns list of OBJECT subcommandsOBJECT FREQ key-- returns decayed LFU access frequency counterOBJECT IDLETIME key-- returns idle seconds derived from LFU ldtOBJECT REFCOUNT key-- always returns 1WAIT numreplicas timeout-- returns 0 immediately (no replication)
Summary
Functions
Handles a generic key command.
Functions
Handles a generic key command.
Parameters
cmd- Uppercased command name (e.g."TYPE","RENAME")args- List of string argumentsstore- Injected store map withget,get_meta,put,delete,exists?,keyscallbacks
Returns
Plain Elixir term: string, integer, list, nil, {:simple, string}, or
{:error, message}.