chameleonbr / node-red-contrib-redis

Node RED client for Redis with pub/sub, list, lua scripting and other commands support.
MIT License
46 stars 42 forks source link

Do you have any documentation on how to use each function of Redis in Node-red ? #61

Open Poon2542 opened 1 year ago

Poon2542 commented 1 year ago

Hi i'm using your npm on node-red. It's really great !!! but i seem at a lost on how to use each function. for example what should i specify in msg.payload , msg.topic ??. if i want to find whether there is a key inside redis i use EXIST function with msg.topic = "Key"; then what about the other??

If you want more clarification you can tell me and i'll try to explain my problem.

golfvert commented 1 year ago

I agree, fantastic tool, with "challenging" documentation. It is, at least for me, a try and error approach... Here is a simple example for EXISTS. All requests follow the same pattern (almost!). Hope this helps.

[
    {
        "id": "b22fc76fde701da6",
        "type": "inject",
        "z": "23a4b7ed06023116",
        "name": "Set",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "[\"key1\",true,\"EX\",10]",
        "payloadType": "jsonata",
        "x": 450,
        "y": 2920,
        "wires": [
            [
                "47089de4fc17527a"
            ]
        ]
    },
    {
        "id": "47089de4fc17527a",
        "type": "redis-command",
        "z": "23a4b7ed06023116",
        "server": "d664c31c10874038",
        "command": "SET",
        "name": "",
        "topic": "",
        "params": "[]",
        "paramsType": "json",
        "payloadType": "json",
        "block": false,
        "x": 580,
        "y": 2920,
        "wires": [
            [
                "a43f1ee4355fb31b"
            ]
        ]
    },
    {
        "id": "a43f1ee4355fb31b",
        "type": "debug",
        "z": "23a4b7ed06023116",
        "name": "debug 44",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 720,
        "y": 2920,
        "wires": []
    },
    {
        "id": "bc0685a74adeb6b9",
        "type": "inject",
        "z": "23a4b7ed06023116",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "key1",
        "payload": "[]",
        "payloadType": "str",
        "x": 430,
        "y": 3000,
        "wires": [
            [
                "a958b165fb0c45e0"
            ]
        ]
    },
    {
        "id": "a958b165fb0c45e0",
        "type": "redis-command",
        "z": "23a4b7ed06023116",
        "server": "d664c31c10874038",
        "command": "EXISTS",
        "name": "",
        "topic": "",
        "params": "[]",
        "paramsType": "json",
        "payloadType": "json",
        "block": false,
        "x": 570,
        "y": 3000,
        "wires": [
            [
                "1bd109f234bcf243"
            ]
        ]
    },
    {
        "id": "1bd109f234bcf243",
        "type": "debug",
        "z": "23a4b7ed06023116",
        "name": "debug 45",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 720,
        "y": 3000,
        "wires": []
    },
    {
        "id": "d664c31c10874038",
        "type": "redis-config",
        "name": "Redis",
        "options": "redis:6379",
        "cluster": false,
        "optionsType": "str"
    }
]