Cmdlets for Redis

Build 24.0.9064

RunCommand

Passes a command to the Redis server for direct execution. Use standard redis-cli syntax.

Running Redis Commands Directly

You can use this procedure to run a command directly that isn't exposed by the usual CRUD operations on tables. For example, the FLUSHDB command removes all keys from the current database:

EXECUTE RunCommand @CommandLine = 'FLUSHDB'

You can also run commands which require parameters by separating them with spaces, the same as in redis-cli. Double-quotes are also available if you need to embed spaces into a parameter value:

EXECUTE RunCommand @CommandLine = 'INFO "CPU"'

The cmdlet will process the results of the command and return them in the appropriate format. For cases like FLUSHDB or INFO where the result is a simple value or a flat array, each element will be returned as a separate row.

'# CPU'
'used_cpu_sys:1272.08'
'used_cpu_user:537.84'
'used_cpu_sys_children:4.81'
'used_cpu_user_children:98.89'

More complex results, like the values returned from the COMMAND command, will be separated by row and then converted to JSON for final output.

'["slowlog","-2",[["admin"]],"0","0","0"]'
'["persist","2",[["write","fast"]],"1","1","1"]'
'["zrevrangebylex","-4",[["readonly"]],"1","1","1"]'
'["sinter","-2",[["readonly","sort_for_script"]],"1","-1","1"]'
'["lrange","4",[["readonly"]],"1","1","1"]'
'["hmset","-4",[["write","denyoom","fast"]],"1","1","1"]'
'["lpush","-3",[["write","denyoom","fast"]],"1","1","1"]'
'["zremrangebyscore","4",[["write"]],"1","1","1"]'
'["FT.DICTDEL","-1",[["readonly"]],"1","1","1"]'
...

Input

Name Type Required Description
CommandLine String False The command to pass directly to the Redis server for execution.
KeyType String False The format for the Redis server output. 'AUTO' returns the keys in list format (nested lists will each be one compound result). 'HASH' returns the keys as a hash (each group is a row, each property gets its own column).

The allowed values are AUTO, HASH.

The default value is AUTO.

Result Set Columns

Name Type Description
* String Output will vary for each collection.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9064