node-red - 读写操作redis
node-red读写redis的相关操作详细图解说明及源码
·
node-red - 读写操作redis
一、前期准备
- 安装配置node-red环境:
- 安装配置redis:
二、node-red安装redis节点
1.在node-red里面安装redis节点 :
node-red-node-redis
node-red-contrib-redis
2. 刷新node-red:
回到目录
三、node-red操作使用redis节点
3.1. List(列表)类型
3.1.1 List(列表)存储 :redis-out节点
redis-out节点负责向redis中存储数据。无返回值,以字符串类型存储,多次触发存储为链表格式。
method说明:
- LPUSH:将元素推入列表左端
- RPUSH:将元素推入列表右端
- 当用户调用LPUSH命令或RPUSH命令尝试将元素推入列表的时候,如果给定的列表并不存在,那么命令将自动创建一个空列表,并将元素推入刚刚创建的列表中。
- LPUSHX:只会在列表已经存在的情况下,将元素推入列表左端
- RPUSHX:只会在列表已经存在的情况下,将元素推入列表右端。
充当发布者,使用RPUSH、LPUSH或PUBLISH
- 配置节点:
(1) server:选择redis实例(可以新建)
主要是Name里面填写带端口号的redis服务器地址:IP:端口
(如:127.0.0.1:6379
)
如果有密码,配置示例如下:
(2)Name: 随意命名
(3)Topic : 为redis中的Key
点我回到目录
3.1.2 List(列表)读取 - redis-in节点
redis-in节点负责从redis中读取数据。该节点实时监听redis对应实例的对应的topic的数据,一旦数据有变化,就会有输出返回。
- 节点配置:
method说明:
- BLPOP: 阻塞式左端弹出操作。BLPOP命令是带有阻塞功能的左端弹出操作,它接受任意多个列表以及一个秒级精度的超时时限作为参数。当BLPOP命令成功对某个非空列表执行了弹出操作之后,它将向用户返回一个包含两个元素的数组:数组的第一个元素记录了执行弹出操作的列表,即被弹出元素的来源列表,而数组的第二个元素则是被弹出元素本身。BLPOP命令会按照从左到右的顺序依次检查用户给定的列表,并对最先遇到的非空列表执行左端元素弹出操作。如果BLPOP命令在检查了用户给定的所有列表之后都没有发现可以执行弹出操作的非空列表,那么它将阻塞执行该命令的客户端并开始等待,直到某个给定列表变为非空,又或者等待时间超出给定时限为止。
- BRPOP:阻塞式右端弹出操作。除了弹出的方向不同之外,其他方面都和BLPOP命令一样。
BLPOP、BRPOP和BRPOPLPUSH是阻塞版本的弹出和推入命令,如果用户给定的所有列表都为空,那么执行命令的客户端将被阻塞,直到给定的阻塞时限到达或者某个给定列表非空为止。
3.2 redis-cmd节点
3.2.1 String(字符串)类型读写
- 赋值:
(1)redis-cmd节点的set命令,返回赋值状态
(2)redis-cmd节点的getset命令,返回实际值 - 取值:redis-cmd节点的get命令,返回实际值,不存在的key返回null
点我回到目录
3.2.2 Set(集合)类型读写
- 赋值:redis-cmd节点的sadd命令,返回插入元素个数,已经存在集合中的元素不重复插入
- redis-cmd节点的sismember命令,判断元素是否存在SET集合中:
(1)存在,返回1;
(2)不存在,返回0。
3.2.3 Hash(key-value)类型读写
- 赋值:redis-cmd节点的hmset命令,返回赋值状态
- 取值:redis-cmd节点的hgetall命令,返回所有key-value
3.3 redis-lua
在Redis内部执行lua脚本,将payload数组作为参数发送,并将结果作为payload返回。
- 选项
(1)存储:如果要使用SCRIPT LOAD和EVALSHA运行脚本,请设置
(2)Keys:发送到lua脚本的键数
(3)脚本:Lua脚本
(4)有效负载:您需要在发送所有值之前、之后发送所有密钥。
点我回到目录
3.4 删除key和监听redis状态
- redis-cmd的del命令,删除指定可以,成功删除返回1
- redis instance实例:监听状态
点我回到目录
四、源码
[
{
"id": "6f6de23b8756ef57",
"type": "tab",
"label": "redis-lua",
"disabled": false,
"info": "",
"env": []
},
{
"id": "5f8949231cd1d4a5",
"type": "tab",
"label": "redis-删除和监听状态",
"disabled": false,
"info": "",
"env": []
},
{
"id": "4df8aefd826300cd",
"type": "tab",
"label": "redis-cmd:Hash类型读写",
"disabled": false,
"info": "",
"env": []
},
{
"id": "fae8381c9955b748",
"type": "tab",
"label": "redis-cmd:SET(集合)类型读写",
"disabled": false,
"info": "",
"env": []
},
{
"id": "f4d0f3ddc36b2578",
"type": "tab",
"label": "redis-cmd:String字符串类型读写",
"disabled": false,
"info": "",
"env": []
},
{
"id": "10df9356af43ca42",
"type": "tab",
"label": "redis-in/out:List列表类型读写",
"disabled": false,
"info": "",
"env": []
},
{
"id": "9fac84f19fc11fba",
"type": "tab",
"label": "流程 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "a0efbb89.5e42d8",
"type": "redis-config",
"name": "local",
"options": "{}",
"cluster": false,
"optionsType": "json"
},
{
"id": "e10f73abae9c78b7",
"type": "comment",
"z": "6f6de23b8756ef57",
"name": "在Redis内部执行lua脚本,将payload数组作为参数发送,并将结果作为payload返回。",
"info": "",
"x": 360,
"y": 60,
"wires": []
},
{
"id": "e681f6617c675038",
"type": "redis-lua-script",
"z": "6f6de23b8756ef57",
"server": "a0efbb89.5e42d8",
"name": "test",
"keyval": 0,
"func": "local text = \"Hello World\"\nreturn text",
"stored": true,
"block": false,
"x": 250,
"y": 140,
"wires": [
[
"d01f7b1431d1222c"
]
]
},
{
"id": "fd2b6447f407a050",
"type": "inject",
"z": "6f6de23b8756ef57",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 100,
"y": 140,
"wires": [
[
"e681f6617c675038"
]
]
},
{
"id": "d01f7b1431d1222c",
"type": "debug",
"z": "6f6de23b8756ef57",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 430,
"y": 140,
"wires": []
},
{
"id": "9c0cba6374fbd6fe",
"type": "redis-lua-script",
"z": "6f6de23b8756ef57",
"server": "a0efbb89.5e42d8",
"name": "test2",
"keyval": 0,
"func": "local text = \"Hello2222 World2222\"\nreturn text",
"stored": false,
"block": false,
"x": 250,
"y": 200,
"wires": [
[
"6969dd7069e83292"
]
]
},
{
"id": "71e9563e76b585b0",
"type": "inject",
"z": "6f6de23b8756ef57",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 100,
"y": 200,
"wires": [
[
"9c0cba6374fbd6fe"
]
]
},
{
"id": "6969dd7069e83292",
"type": "debug",
"z": "6f6de23b8756ef57",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 430,
"y": 200,
"wires": []
},
{
"id": "2427a75850c5b272",
"type": "redis-command",
"z": "5f8949231cd1d4a5",
"server": "a0efbb89.5e42d8",
"command": "del",
"name": "",
"topic": "",
"params": "[]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 280,
"y": 80,
"wires": [
[
"70e2c04ae207a236"
]
]
},
{
"id": "4bec132ccca20c06",
"type": "inject",
"z": "5f8949231cd1d4a5",
"name": "",
"props": [
{
"p": "payload",
"v": "[]",
"vt": "json"
},
{
"p": "topic",
"v": "key",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "key",
"payload": "[]",
"payloadType": "json",
"x": 130,
"y": 80,
"wires": [
[
"2427a75850c5b272"
]
]
},
{
"id": "70e2c04ae207a236",
"type": "debug",
"z": "5f8949231cd1d4a5",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 450,
"y": 80,
"wires": []
},
{
"id": "d9f956eefadb67f1",
"type": "redis-instance",
"z": "5f8949231cd1d4a5",
"server": "a0efbb89.5e42d8",
"name": "",
"topic": "redis",
"location": "flow",
"x": 110,
"y": 260,
"wires": []
},
{
"id": "51a4a837255d322e",
"type": "inject",
"z": "5f8949231cd1d4a5",
"name": "",
"props": [
{
"p": "payload",
"v": "",
"vt": "date"
},
{
"p": "topic",
"v": "",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 320,
"wires": [
[
"1859a1478808bafd"
]
]
},
{
"id": "1859a1478808bafd",
"type": "function",
"z": "5f8949231cd1d4a5",
"name": "",
"func": "let redis = context.flow.get('redis');\n\nredis.info().then((data)=>{\n msg.payload = data\n node.send(msg);\n})\n\n/*\nredis.call(\"anycmd\").then((data)=>{\n msg.payload = data\n node.send(msg);\n})*/",
"outputs": 1,
"noerr": 0,
"x": 270,
"y": 320,
"wires": [
[
"7e2d3163eab1ef3b"
]
]
},
{
"id": "7e2d3163eab1ef3b",
"type": "debug",
"z": "5f8949231cd1d4a5",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 410,
"y": 320,
"wires": []
},
{
"id": "f3fc26413cf5ad08",
"type": "comment",
"z": "5f8949231cd1d4a5",
"name": "删除指定key,成功删除返回1",
"info": "",
"x": 200,
"y": 40,
"wires": []
},
{
"id": "8f1f34ebcb85614b",
"type": "comment",
"z": "5f8949231cd1d4a5",
"name": "监听redis实例状态",
"info": "",
"x": 150,
"y": 220,
"wires": []
},
{
"id": "454b92b2a97ca654",
"type": "comment",
"z": "4df8aefd826300cd",
"name": "redis-cmd 读取hash数据",
"info": "",
"x": 190,
"y": 300,
"wires": []
},
{
"id": "11634ff056ba9628",
"type": "inject",
"z": "4df8aefd826300cd",
"name": "",
"props": [
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "testk7",
"x": 90,
"y": 360,
"wires": [
[
"e25c32879a8fa62a"
]
]
},
{
"id": "b3cab3157c67fc8e",
"type": "debug",
"z": "4df8aefd826300cd",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 550,
"y": 360,
"wires": []
},
{
"id": "5e8485537c30b010",
"type": "inject",
"z": "4df8aefd826300cd",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 90,
"y": 400,
"wires": [
[
"17ec777b3ffcf5f4"
]
]
},
{
"id": "17ec777b3ffcf5f4",
"type": "function",
"z": "4df8aefd826300cd",
"name": "赋值",
"func": "msg.topic = \"testk7\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 210,
"y": 400,
"wires": [
[
"e25c32879a8fa62a"
]
]
},
{
"id": "451ed4474c9a6a3a",
"type": "inject",
"z": "4df8aefd826300cd",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 90,
"y": 460,
"wires": [
[
"7954af1ab76c0d77"
]
]
},
{
"id": "dcb416e34aeb03a4",
"type": "debug",
"z": "4df8aefd826300cd",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 450,
"y": 460,
"wires": []
},
{
"id": "e25c32879a8fa62a",
"type": "redis-command",
"z": "4df8aefd826300cd",
"server": "a0efbb89.5e42d8",
"command": "hgetall",
"name": "",
"topic": "",
"params": "{}",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 350,
"y": 360,
"wires": [
[
"b3cab3157c67fc8e"
]
]
},
{
"id": "071349ab84962202",
"type": "comment",
"z": "4df8aefd826300cd",
"name": "获取redis主题HASH类型的value",
"info": "",
"x": 450,
"y": 400,
"wires": []
},
{
"id": "7954af1ab76c0d77",
"type": "redis-command",
"z": "4df8aefd826300cd",
"server": "a0efbb89.5e42d8",
"command": "hgetall",
"name": "",
"topic": "testk7",
"params": "{}",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 270,
"y": 460,
"wires": [
[
"dcb416e34aeb03a4"
]
]
},
{
"id": "98a6388ab1d97652",
"type": "comment",
"z": "4df8aefd826300cd",
"name": "redis-cmd- 向redis存储数据 - 有返回值,存储为key-value格式",
"info": "",
"x": 300,
"y": 80,
"wires": []
},
{
"id": "b03b3fcb3d94d479",
"type": "inject",
"z": "4df8aefd826300cd",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 90,
"y": 160,
"wires": [
[
"7886dba090b2d5c6"
]
]
},
{
"id": "7886dba090b2d5c6",
"type": "function",
"z": "4df8aefd826300cd",
"name": "赋值",
"func": "msg.payload = { \n \"a\": 111,\n \"b\": 122\n};\nmsg.topic = \"testk6\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 210,
"y": 160,
"wires": [
[
"4ede2b8fbd285845"
]
]
},
{
"id": "3246292b1e6ec62b",
"type": "comment",
"z": "4df8aefd826300cd",
"name": "直接在fun中定义topic - key",
"info": "",
"x": 410,
"y": 120,
"wires": []
},
{
"id": "b09ad023d012a2d7",
"type": "debug",
"z": "4df8aefd826300cd",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 510,
"y": 160,
"wires": []
},
{
"id": "4ede2b8fbd285845",
"type": "redis-command",
"z": "4df8aefd826300cd",
"server": "a0efbb89.5e42d8",
"command": "hmset",
"name": "",
"topic": "",
"params": "[]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 350,
"y": 160,
"wires": [
[
"b09ad023d012a2d7"
]
]
},
{
"id": "e76e792099391cfa",
"type": "inject",
"z": "4df8aefd826300cd",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 90,
"y": 240,
"wires": [
[
"ec0c97f182bdbeb9"
]
]
},
{
"id": "ec0c97f182bdbeb9",
"type": "function",
"z": "4df8aefd826300cd",
"name": "赋值",
"func": "msg.payload = { \n \"a\":2023,\n \"c\": 23,\n \"d\": 12\n};\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 210,
"y": 240,
"wires": [
[
"5ac3703b5f6b6451"
]
]
},
{
"id": "7088ac847896e050",
"type": "debug",
"z": "4df8aefd826300cd",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 510,
"y": 240,
"wires": []
},
{
"id": "5ac3703b5f6b6451",
"type": "redis-command",
"z": "4df8aefd826300cd",
"server": "a0efbb89.5e42d8",
"command": "hmset",
"name": "redis-cmd",
"topic": "testk7",
"params": "[]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 340,
"y": 240,
"wires": [
[
"7088ac847896e050"
]
]
},
{
"id": "1d306d1a3212114a",
"type": "comment",
"z": "4df8aefd826300cd",
"name": "在redis-out中指定topic - key",
"info": "",
"x": 420,
"y": 200,
"wires": []
},
{
"id": "e2859bca1b363f10",
"type": "comment",
"z": "4df8aefd826300cd",
"name": "redis-cmd:读写HASH数据结构(KEY-VALUE)",
"info": "",
"x": 200,
"y": 40,
"wires": []
},
{
"id": "63d763dd294e84f7",
"type": "comment",
"z": "fae8381c9955b748",
"name": "redis-cmd:写入SET数据结构(不重复集合)",
"info": "输入:\n topic:key\n params集合值:[值1,值2,...]\n输出:\n 插入到集合的元素个数(重复数值不重复插入)",
"x": 210,
"y": 40,
"wires": []
},
{
"id": "1cf45dfb00c46752",
"type": "inject",
"z": "fae8381c9955b748",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 110,
"y": 100,
"wires": [
[
"15e81f14475cf5e6"
]
]
},
{
"id": "02377d28c30bdeac",
"type": "debug",
"z": "fae8381c9955b748",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 470,
"y": 100,
"wires": []
},
{
"id": "15e81f14475cf5e6",
"type": "redis-command",
"z": "fae8381c9955b748",
"server": "a0efbb89.5e42d8",
"command": "sadd",
"name": "",
"topic": "mySet",
"params": "[\"memberA\",\"memberB\",\"memberC\",\"memberC\",\"memberD\",\"menberE\"]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 290,
"y": 100,
"wires": [
[
"02377d28c30bdeac"
]
]
},
{
"id": "950c3bf4a885a73d",
"type": "inject",
"z": "fae8381c9955b748",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 110,
"y": 160,
"wires": [
[
"0f76b46266189ef0"
]
]
},
{
"id": "6d93f60a9156bcdb",
"type": "debug",
"z": "fae8381c9955b748",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 590,
"y": 160,
"wires": []
},
{
"id": "f8e38a71406e83d4",
"type": "redis-command",
"z": "fae8381c9955b748",
"server": "a0efbb89.5e42d8",
"command": "sadd",
"name": "",
"topic": "",
"params": "[1,34,6]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 410,
"y": 160,
"wires": [
[
"6d93f60a9156bcdb"
]
]
},
{
"id": "0f76b46266189ef0",
"type": "function",
"z": "fae8381c9955b748",
"name": "function 1",
"func": "msg.topic=\"set1\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 260,
"y": 160,
"wires": [
[
"f8e38a71406e83d4"
]
]
},
{
"id": "6906e4594eaa8417",
"type": "comment",
"z": "fae8381c9955b748",
"name": "redis-cmd:SISMEMBER 判断元素是否存在SET集合中,存在,返回1;不存在,返回0。",
"info": "判断一个集合类型数据结构中是否存在指定的元素。如果存在,该命令会返回1;如果不存在,会返回0。",
"x": 340,
"y": 220,
"wires": []
},
{
"id": "7aad67b638f8d226",
"type": "inject",
"z": "fae8381c9955b748",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 110,
"y": 260,
"wires": [
[
"583a8c34708dd791"
]
]
},
{
"id": "b66e099a9d74e684",
"type": "debug",
"z": "fae8381c9955b748",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 550,
"y": 260,
"wires": []
},
{
"id": "583a8c34708dd791",
"type": "redis-command",
"z": "fae8381c9955b748",
"server": "a0efbb89.5e42d8",
"command": "sismember",
"name": "",
"topic": "mySet",
"params": "[\"memberD\"]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 330,
"y": 260,
"wires": [
[
"b66e099a9d74e684"
]
]
},
{
"id": "2b3c2c00d006f90e",
"type": "redis-command",
"z": "fae8381c9955b748",
"server": "a0efbb89.5e42d8",
"command": "sismember",
"name": "",
"topic": "",
"params": "[34]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 420,
"y": 320,
"wires": [
[
"d85e2f9f23195d6c"
]
]
},
{
"id": "d85e2f9f23195d6c",
"type": "debug",
"z": "fae8381c9955b748",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 610,
"y": 320,
"wires": []
},
{
"id": "1af1e6ab9294f27f",
"type": "inject",
"z": "fae8381c9955b748",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 110,
"y": 320,
"wires": [
[
"9d95d697a45277a6"
]
]
},
{
"id": "9d95d697a45277a6",
"type": "function",
"z": "fae8381c9955b748",
"name": "function 2",
"func": "msg.topic = \"set1\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 240,
"y": 320,
"wires": [
[
"2b3c2c00d006f90e"
]
]
},
{
"id": "8726a41f0e9d9afd",
"type": "redis-command",
"z": "f4d0f3ddc36b2578",
"server": "a0efbb89.5e42d8",
"command": "set",
"name": "",
"topic": "",
"params": "[]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 280,
"y": 80,
"wires": [
[
"5ed39aa8fb440dde"
]
]
},
{
"id": "edc7a0b9c3c07068",
"type": "inject",
"z": "f4d0f3ddc36b2578",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[\"key\",\"value\"]",
"payloadType": "json",
"x": 110,
"y": 80,
"wires": [
[
"8726a41f0e9d9afd"
]
]
},
{
"id": "5ed39aa8fb440dde",
"type": "debug",
"z": "f4d0f3ddc36b2578",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 430,
"y": 80,
"wires": []
},
{
"id": "265a86a798c32245",
"type": "function",
"z": "f4d0f3ddc36b2578",
"name": "function 3",
"func": "msg.topic = \"str1\";\nmsg.payload = \"hello world!\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 240,
"y": 140,
"wires": [
[
"015bc6371d2e0651"
]
]
},
{
"id": "8a23161f20e38d61",
"type": "inject",
"z": "f4d0f3ddc36b2578",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 90,
"y": 140,
"wires": [
[
"265a86a798c32245"
]
]
},
{
"id": "2eb8eb8231b958f7",
"type": "debug",
"z": "f4d0f3ddc36b2578",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 530,
"y": 140,
"wires": []
},
{
"id": "0006a48684e4025b",
"type": "comment",
"z": "f4d0f3ddc36b2578",
"name": "redis-cmd:赋值String字符串类型,返回赋值状态:成功赋值返回ok",
"info": "",
"x": 260,
"y": 40,
"wires": []
},
{
"id": "015bc6371d2e0651",
"type": "redis-command",
"z": "f4d0f3ddc36b2578",
"server": "a0efbb89.5e42d8",
"command": "set",
"name": "",
"topic": "",
"params": "[]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 380,
"y": 140,
"wires": [
[
"2eb8eb8231b958f7"
]
]
},
{
"id": "0ed9f27bf30cb808",
"type": "function",
"z": "f4d0f3ddc36b2578",
"name": "function 4",
"func": "msg.topic = \"str1\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 240,
"y": 380,
"wires": [
[
"21e78658c7f14970"
]
]
},
{
"id": "c29d94c2e668be96",
"type": "inject",
"z": "f4d0f3ddc36b2578",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 90,
"y": 380,
"wires": [
[
"0ed9f27bf30cb808"
]
]
},
{
"id": "371a1192b4ac1ec4",
"type": "debug",
"z": "f4d0f3ddc36b2578",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 670,
"y": 460,
"wires": []
},
{
"id": "836126495aeebfe1",
"type": "comment",
"z": "f4d0f3ddc36b2578",
"name": "redis-cmd:获取String字符串类型",
"info": "",
"x": 150,
"y": 340,
"wires": []
},
{
"id": "21e78658c7f14970",
"type": "redis-command",
"z": "f4d0f3ddc36b2578",
"server": "a0efbb89.5e42d8",
"command": "get",
"name": "",
"topic": "",
"params": "[]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 380,
"y": 380,
"wires": [
[
"371a1192b4ac1ec4"
]
]
},
{
"id": "16567be03f3acd05",
"type": "redis-command",
"z": "f4d0f3ddc36b2578",
"server": "a0efbb89.5e42d8",
"command": "get",
"name": "",
"topic": "str1",
"params": "[]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 270,
"y": 500,
"wires": [
[
"371a1192b4ac1ec4"
]
]
},
{
"id": "0a37a6f4f4844e14",
"type": "inject",
"z": "f4d0f3ddc36b2578",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 90,
"y": 500,
"wires": [
[
"16567be03f3acd05"
]
]
},
{
"id": "89188a652caa50b4",
"type": "comment",
"z": "f4d0f3ddc36b2578",
"name": "redis-cmd:赋值String字符串类型,返回的是具体值",
"info": "",
"x": 210,
"y": 200,
"wires": []
},
{
"id": "47682ec228bf7396",
"type": "redis-command",
"z": "f4d0f3ddc36b2578",
"server": "a0efbb89.5e42d8",
"command": "getset",
"name": "",
"topic": "",
"params": "[]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 390,
"y": 240,
"wires": [
[
"62c6ef6805a01170"
]
]
},
{
"id": "6258c28fb55949c0",
"type": "inject",
"z": "f4d0f3ddc36b2578",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "key",
"payload": "[\"dedsd\"]",
"payloadType": "json",
"x": 110,
"y": 240,
"wires": [
[
"47682ec228bf7396"
]
]
},
{
"id": "62c6ef6805a01170",
"type": "debug",
"z": "f4d0f3ddc36b2578",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 550,
"y": 240,
"wires": []
},
{
"id": "fe58103902cf7f11",
"type": "inject",
"z": "f4d0f3ddc36b2578",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 90,
"y": 280,
"wires": [
[
"654f3344690ab652"
]
]
},
{
"id": "654f3344690ab652",
"type": "function",
"z": "f4d0f3ddc36b2578",
"name": "function 5",
"func": "msg.topic = \"str1\";\nmsg.payload = [\"getset hello world! \"];\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 240,
"y": 280,
"wires": [
[
"47682ec228bf7396"
]
]
},
{
"id": "b1cd496eef97f8af",
"type": "inject",
"z": "f4d0f3ddc36b2578",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 90,
"y": 440,
"wires": [
[
"5f7dc14fab2a5b46"
]
]
},
{
"id": "5f7dc14fab2a5b46",
"type": "function",
"z": "f4d0f3ddc36b2578",
"name": "function 6",
"func": "msg.topic = \"str2\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 240,
"y": 440,
"wires": [
[
"21e78658c7f14970"
]
]
},
{
"id": "5d605b6f675de84c",
"type": "comment",
"z": "f4d0f3ddc36b2578",
"name": "不存在的key返回null",
"info": "",
"x": 410,
"y": 440,
"wires": []
},
{
"id": "857f5ca5c3e12b88",
"type": "inject",
"z": "10df9356af43ca42",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 110,
"y": 120,
"wires": [
[
"e5adf43d4b6f6aaf"
]
]
},
{
"id": "197e2dcf9b16acc7",
"type": "comment",
"z": "10df9356af43ca42",
"name": "redis-out - 向redis存储数据 - 无返回值,以字符串类型存储,多次触发存储为链表格式",
"info": "",
"x": 330,
"y": 40,
"wires": []
},
{
"id": "41beb90d34bbcef5",
"type": "redis-out",
"z": "10df9356af43ca42",
"server": "a0efbb89.5e42d8",
"command": "rpush",
"name": "redis-out",
"topic": "",
"obj": true,
"x": 400,
"y": 120,
"wires": []
},
{
"id": "e5adf43d4b6f6aaf",
"type": "function",
"z": "10df9356af43ca42",
"name": "赋值",
"func": "msg.payload = { \"a\": 11, \"b\": 122 };\n//msg.payload = { \"a\": 110, \"b\": 122 };\nmsg.topic = \"testL1\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 250,
"y": 120,
"wires": [
[
"41beb90d34bbcef5"
]
]
},
{
"id": "3d19bee7f2b0174d",
"type": "inject",
"z": "10df9356af43ca42",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 110,
"y": 200,
"wires": [
[
"caa2c7512a4522c4"
]
]
},
{
"id": "6a9ed18f7cbb5928",
"type": "redis-out",
"z": "10df9356af43ca42",
"server": "a0efbb89.5e42d8",
"command": "rpush",
"name": "redis-out",
"topic": "testL2",
"obj": true,
"x": 400,
"y": 200,
"wires": []
},
{
"id": "caa2c7512a4522c4",
"type": "function",
"z": "10df9356af43ca42",
"name": "赋值",
"func": "msg.payload = [\"cfddf\"];\n//msg.payload = [\"cfdDEDSDdf\"]\n//msg.payload = \"cfdDEDSDdf\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 250,
"y": 200,
"wires": [
[
"6a9ed18f7cbb5928"
]
]
},
{
"id": "821f08d36d181168",
"type": "comment",
"z": "10df9356af43ca42",
"name": "直接在fun中定义topic - key",
"info": "",
"x": 410,
"y": 80,
"wires": []
},
{
"id": "c499e2d6b346126a",
"type": "comment",
"z": "10df9356af43ca42",
"name": "在redis-out中指定topic - key",
"info": "",
"x": 420,
"y": 160,
"wires": []
},
{
"id": "22cbda9cc482f09e",
"type": "debug",
"z": "10df9356af43ca42",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 210,
"y": 480,
"wires": []
},
{
"id": "3507699dfffa3708",
"type": "redis-in",
"z": "10df9356af43ca42",
"server": "a0efbb89.5e42d8",
"command": "blpop",
"name": "",
"topic": "testL1",
"obj": true,
"timeout": "0",
"x": 70,
"y": 480,
"wires": [
[
"22cbda9cc482f09e"
]
]
},
{
"id": "2e745fd1aa99d68d",
"type": "comment",
"z": "10df9356af43ca42",
"name": "BLPOP 带有阻塞功能的左端弹出操作,它接受任意多个列表以及一个秒级精度的超时时限作为参数。",
"info": "",
"x": 460,
"y": 440,
"wires": []
},
{
"id": "6fdc93a103b913fc",
"type": "comment",
"z": "10df9356af43ca42",
"name": "redis-in 阻塞式读取redis数据",
"info": "",
"x": 140,
"y": 400,
"wires": []
},
{
"id": "50e92a9b26c05ecc",
"type": "redis-in",
"z": "10df9356af43ca42",
"server": "a0efbb89.5e42d8",
"command": "brpop",
"name": "",
"topic": "testL2",
"obj": true,
"timeout": "3",
"x": 70,
"y": 560,
"wires": [
[
"7144e5e8a08e65c8"
]
]
},
{
"id": "7144e5e8a08e65c8",
"type": "debug",
"z": "10df9356af43ca42",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 210,
"y": 560,
"wires": []
},
{
"id": "7f46809aa633bb50",
"type": "comment",
"z": "10df9356af43ca42",
"name": "BRPOP-带有阻塞功能的右端弹出操作,它接受任意多个列表以及一个秒级精度的超时时限作为参数。",
"info": "",
"x": 460,
"y": 520,
"wires": []
},
{
"id": "0e60418c878644aa",
"type": "inject",
"z": "10df9356af43ca42",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 110,
"y": 260,
"wires": [
[
"cfa81e74d9d2c32a"
]
]
},
{
"id": "158da8d1a05f2852",
"type": "redis-out",
"z": "10df9356af43ca42",
"server": "a0efbb89.5e42d8",
"command": "rpush",
"name": "redis-out",
"topic": "testL3",
"obj": true,
"x": 400,
"y": 260,
"wires": []
},
{
"id": "cfa81e74d9d2c32a",
"type": "function",
"z": "10df9356af43ca42",
"name": "赋值",
"func": "msg.payload = [\"cfddf\"];\n//msg.payload = [\"cfdDEDSDdf\"]\n//msg.payload = \"cfdDEDSDdf\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 250,
"y": 260,
"wires": [
[
"158da8d1a05f2852"
]
]
},
{
"id": "b4c7f934ed47e083",
"type": "inject",
"z": "10df9356af43ca42",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 110,
"y": 320,
"wires": [
[
"2f7f3dcdacab9c98"
]
]
},
{
"id": "2f7f3dcdacab9c98",
"type": "function",
"z": "10df9356af43ca42",
"name": "赋值",
"func": "msg.topic = \"testL4\";\nmsg.payload = \"msg96\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 230,
"y": 320,
"wires": [
[
"b860432f97c32081"
]
]
},
{
"id": "b860432f97c32081",
"type": "redis-out",
"z": "10df9356af43ca42",
"server": "a0efbb89.5e42d8",
"command": "rpush",
"name": "redis-out",
"topic": "",
"obj": true,
"x": 380,
"y": 320,
"wires": []
},
{
"id": "31f1fcb.a6a4a04",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 630,
"y": 260,
"wires": []
},
{
"id": "80d063ee.78deb8",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 100,
"y": 260,
"wires": [
[
"4cb7b20e.778d34"
]
]
},
{
"id": "4cb7b20e.778d34",
"type": "redis-out",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"command": "rpush",
"name": "",
"topic": "test",
"x": 390,
"y": 220,
"wires": []
},
{
"id": "902b8385.2fdd9",
"type": "redis-in",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"command": "blpop",
"name": "",
"topic": "test",
"timeout": 0,
"x": 390,
"y": 260,
"wires": [
[
"31f1fcb.a6a4a04"
]
]
},
{
"id": "6373a8a4.82bad",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"props": [
{
"p": "payload",
"v": "{\"a\":1,\"b\":2}",
"vt": "json"
},
{
"p": "topic",
"v": "",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"a\":1,\"b\":2}",
"payloadType": "json",
"x": 110,
"y": 220,
"wires": [
[
"4cb7b20e.778d34"
]
]
},
{
"id": "f248c9ea.674658",
"type": "redis-command",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"command": "getset",
"name": "",
"topic": "timestamp",
"params": "[]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 370,
"y": 320,
"wires": [
[
"3351713f.42e916"
]
]
},
{
"id": "424ef610.bbb3a8",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 100,
"y": 320,
"wires": [
[
"f248c9ea.674658"
]
]
},
{
"id": "3351713f.42e916",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 610,
"y": 320,
"wires": []
},
{
"id": "ba433622.8c6178",
"type": "catch",
"z": "9fac84f19fc11fba",
"name": "",
"scope": null,
"uncaught": false,
"x": 400,
"y": 160,
"wires": [
[
"ec2978af.3e0458"
]
]
},
{
"id": "ec2978af.3e0458",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 630,
"y": 160,
"wires": []
},
{
"id": "eccd31de.55e3a",
"type": "redis-command",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"command": "set",
"name": "",
"topic": "",
"params": "[]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 320,
"y": 380,
"wires": [
[
"6ac31b1f.b393c4"
]
]
},
{
"id": "46f5d0c0.8a7198",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[\"key\",\"value\"]",
"payloadType": "json",
"x": 110,
"y": 380,
"wires": [
[
"eccd31de.55e3a"
]
]
},
{
"id": "6ac31b1f.b393c4",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 610,
"y": 380,
"wires": []
},
{
"id": "9f960d71.749988",
"type": "redis-command",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"command": "getset",
"name": "",
"topic": "",
"params": "[]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 330,
"y": 440,
"wires": [
[
"7cef7ea5.dba3b"
]
]
},
{
"id": "f16ad786.8b294",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "key",
"payload": "[\"value\"]",
"payloadType": "json",
"x": 110,
"y": 440,
"wires": [
[
"9f960d71.749988"
]
]
},
{
"id": "7cef7ea5.dba3b",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 610,
"y": 440,
"wires": []
},
{
"id": "7e45a50c.240f7c",
"type": "redis-command",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"command": "hmset",
"name": "",
"topic": "",
"params": "[]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 330,
"y": 560,
"wires": [
[
"122ff416.a56b8c"
]
]
},
{
"id": "488a7f5b.a40628",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "myHash",
"payload": "{\"a\":1,\"b\":2}",
"payloadType": "json",
"x": 130,
"y": 560,
"wires": [
[
"7e45a50c.240f7c"
]
]
},
{
"id": "122ff416.a56b8c",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 610,
"y": 560,
"wires": []
},
{
"id": "aff97bc7.84a578",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "false",
"payloadType": "bool",
"x": 90,
"y": 620,
"wires": [
[
"1676f695.aa7189"
]
]
},
{
"id": "2f4295b5.f78d42",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 610,
"y": 620,
"wires": []
},
{
"id": "1676f695.aa7189",
"type": "redis-command",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"command": "hgetall",
"name": "",
"topic": "myHash",
"params": "{}",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 360,
"y": 620,
"wires": [
[
"2f4295b5.f78d42"
]
]
},
{
"id": "66098945.141118",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "false",
"payloadType": "bool",
"x": 90,
"y": 680,
"wires": [
[
"e42d2b3b.6bb"
]
]
},
{
"id": "e23fbe8.d7505c",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 610,
"y": 680,
"wires": []
},
{
"id": "e42d2b3b.6bb",
"type": "redis-command",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"command": "sadd",
"name": "",
"topic": "mySet",
"params": "[\"memberA\",\"memberB\",\"memberC\"]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 350,
"y": 680,
"wires": [
[
"e23fbe8.d7505c"
]
]
},
{
"id": "2163c482.b8a244",
"type": "redis-command",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"command": "get",
"name": "",
"topic": "",
"params": "[]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 320,
"y": 500,
"wires": [
[
"d2ea99d4.a4c51"
]
]
},
{
"id": "b5f040ea.800be8",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "key",
"payload": "[]",
"payloadType": "json",
"x": 90,
"y": 500,
"wires": [
[
"2163c482.b8a244"
]
]
},
{
"id": "d2ea99d4.a4c51",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 630,
"y": 500,
"wires": []
},
{
"id": "15f62858.26419",
"type": "redis-lua-script",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"name": "test",
"keyval": 0,
"func": "local text = \"Hello World\"\nreturn text",
"stored": true,
"block": false,
"x": 310,
"y": 800,
"wires": [
[
"4a40fc2d.b70e2c"
]
]
},
{
"id": "4f1fc69d.539ee",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 100,
"y": 800,
"wires": [
[
"15f62858.26419"
]
]
},
{
"id": "4a40fc2d.b70e2c",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 630,
"y": 800,
"wires": []
},
{
"id": "6ebb1fdf.2fce",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "false",
"payloadType": "bool",
"x": 90,
"y": 740,
"wires": [
[
"5a3d77f4.920fd8"
]
]
},
{
"id": "bac6944e.4e07",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 610,
"y": 740,
"wires": []
},
{
"id": "5a3d77f4.920fd8",
"type": "redis-command",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"command": "sismember",
"name": "",
"topic": "mySet",
"params": "[\"memberA\"]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 370,
"y": 740,
"wires": [
[
"bac6944e.4e07"
]
]
},
{
"id": "c1c3a5a6.c289f",
"type": "redis-lua-script",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"name": "test2",
"keyval": 0,
"func": "local text = \"Hello2222 World2222\"\nreturn text",
"stored": false,
"block": false,
"x": 310,
"y": 860,
"wires": [
[
"d8bd4107.683c08"
]
]
},
{
"id": "9013d649.88c35",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 100,
"y": 860,
"wires": [
[
"c1c3a5a6.c289f"
]
]
},
{
"id": "d8bd4107.683c08",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 630,
"y": 860,
"wires": []
},
{
"id": "cb44db96.c64bb8",
"type": "redis-in",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"command": "psubscribe",
"name": "",
"topic": "TOPIC:*",
"timeout": 0,
"x": 400,
"y": 40,
"wires": [
[
"78033f6c.31797"
]
]
},
{
"id": "78033f6c.31797",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 630,
"y": 40,
"wires": []
},
{
"id": "dac5fcff.4c4cb",
"type": "redis-in",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"command": "subscribe",
"name": "",
"topic": "TOPIC:OK",
"timeout": 0,
"x": 400,
"y": 100,
"wires": [
[
"6f01eb54.501e7c"
]
]
},
{
"id": "6f01eb54.501e7c",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 630,
"y": 100,
"wires": []
},
{
"id": "e0d2924b.210708",
"type": "redis-out",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"command": "publish",
"name": "",
"topic": "TOPIC:OK",
"x": 130,
"y": 160,
"wires": []
},
{
"id": "d1fc59dc.bd4958",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"props": [
{
"p": "payload",
"v": "{\"a\":1,\"b\":2}",
"vt": "json"
},
{
"p": "topic",
"v": "",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"a\":1,\"b\":2}",
"payloadType": "json",
"x": 110,
"y": 60,
"wires": [
[
"e0d2924b.210708"
]
]
},
{
"id": "3e05b777.781bd8",
"type": "redis-command",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"command": "del",
"name": "",
"topic": "",
"params": "[]",
"paramsType": "json",
"payloadType": "json",
"block": false,
"x": 320,
"y": 920,
"wires": [
[
"fd036d2b.dc6d38"
]
]
},
{
"id": "6924006.91553",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "key",
"payload": "[]",
"payloadType": "json",
"x": 90,
"y": 920,
"wires": [
[
"3e05b777.781bd8"
]
]
},
{
"id": "fd036d2b.dc6d38",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 630,
"y": 920,
"wires": []
},
{
"id": "a13d2797.8a7ff",
"type": "redis-instance",
"z": "9fac84f19fc11fba",
"server": "a0efbb89.5e42d8",
"name": "",
"topic": "redis",
"location": "flow",
"x": 70,
"y": 980,
"wires": []
},
{
"id": "2a93e7ce.341078",
"type": "inject",
"z": "9fac84f19fc11fba",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 80,
"y": 1020,
"wires": [
[
"d89709ef.fd9368"
]
]
},
{
"id": "d89709ef.fd9368",
"type": "function",
"z": "9fac84f19fc11fba",
"name": "",
"func": "let redis = context.flow.get('redis');\n\nredis.info().then((data)=>{\n msg.payload = data\n node.send(msg);\n})\n\n/*\nredis.call(\"anycmd\").then((data)=>{\n msg.payload = data\n node.send(msg);\n})*/",
"outputs": 1,
"noerr": 0,
"x": 310,
"y": 1020,
"wires": [
[
"f2e9c3a0.8f181"
]
]
},
{
"id": "f2e9c3a0.8f181",
"type": "debug",
"z": "9fac84f19fc11fba",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 630,
"y": 1020,
"wires": []
}
]
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献32条内容
所有评论(0)