Redis Step
Overview
Redis step is used to access Redis database and make queries on the database
Configuration
Connection string
- the Redis connection stringexample: redis[s]://[[username][:password]@][host][:port][/db-number]
Use TLS
- flag, to be set totrue
if redis is tls enabled.TLS Key
- TLS private key string. Suggested apporach is to use environment variable.TLS Cert
- TLS cert string. Suggested apporach is to use environment variable.TLS CA
- TLS CA string. Suggested apporach is to use environment variableConfiguration
- list of queries to be madeaction
- the action to preform - currently supported areget
,set
,delete
andcustom
methodstarget path
- thedoc
node on which to attach the result of querypayload
- used in custom method to specify witch Redis method should be executedexample: ["SET", "key", "value"]
options
- used to provide additional options for methodkey
- key to be saved in database also used to find existing key value pair in databasevalue
- value to be saved in databasedoJsonStringify
- specify if value that will be saved in database should be stringified (this should be true for all values that are not strings)doJsonParse
- specify if returned value should be parsed (this is mandatory for all values that where stringified before saving)
info
Below is a suggested approach to define the tls Key, Cert and CA.
{{$env.REDIS_CACHE_TLS_KEY}}
info
Find ways to use additional options here Redis-node documentation
For full list of Redis commands refer to Redis commands
Examples
GET
Redis step get configuration
stepType: redis
config:
actions:
- action: get
options: {}
key: test
target: result
doJsonParse: false
connectionString: redis://127.0.0.1:6379
name: Redis
description: ""
condition: ""
Flow Result
{
"doc": {
"result": "test"
},
"errors": [],
"performance": {
"steps": [
{
"step": "redis",
"executionTime": 25
}
],
"executionTimeOfFlow": 26,
"timeMetric": "ms"
}
}
Redis GET Flow Example
tags:
- general
steps:
- stepType: redis
config:
actions:
- action: get
options: {}
key: test
target: result
doJsonParse: false
connectionString: redis://127.0.0.1:6379
name: Redis
description: ""
condition: ""
sampleData: {}
SET
Redis step set configuration
stepType: redis
config:
actions:
- action: set
options: {}
key: test
value: test
target: result
doJsonStringify: false
connectionString: redis://127.0.0.1:6379
name: Redis
description: ""
condition: ""
Flow Result
{
"doc": {
"result": "OK"
},
"errors": [],
"performance": {
"steps": [
{
"step": "redis",
"executionTime": 25
}
],
"executionTimeOfFlow": 26,
"timeMetric": "ms"
}
}
Redis SET Flow Example
tags:
- general
steps:
- stepType: redis
config:
actions:
- action: set
options: {}
key: test
value: test
target: result
doJsonStringify: false
connectionString: redis://127.0.0.1:6379
name: Redis
description: ""
condition: ""
sampleData: {}
DELETE
Redis step delete configuration
stepType: redis
config:
actions:
- action: delete
options: {}
key: test
target: result
connectionString: redis://127.0.0.1:6379
name: Redis
description: ""
condition: ""
Flow Result
{
"doc": {
"result": 1
},
"errors": [],
"performance": {
"steps": [
{
"step": "redis",
"executionTime": 25
}
],
"executionTimeOfFlow": 26,
"timeMetric": "ms"
}
}
Redis DELETE Flow Example
tags:
- general
steps:
- stepType: redis
config:
actions:
- action: delete
options: {}
key: test
target: result
connectionString: redis://127.0.0.1:6379
name: Redis
description: ""
condition: ""
sampleData: {}
CUSTOM
Redis step custom configuration
stepType: redis
config:
actions:
- action: custom
options: {}
payload:
- SET
- key
- value
target: result
connectionString: redis://127.0.0.1:6379
name: Redis
description: ""
condition: ""
Flow Result
{
"doc": {
"result": "OK"
},
"errors": [],
"performance": {
"steps": [
{
"step": "redis",
"executionTime": 25
}
],
"executionTimeOfFlow": 26,
"timeMetric": "ms"
}
}
Redis CUSTOM Flow Example
tags:
- general
steps:
- stepType: redis
config:
actions:
- action: custom
options: {}
payload:
- SET
- key
- value
target: result
connectionString: redis://127.0.0.1:6379
name: Redis
description: ""
condition: ""
sampleData: {}