当前位置:网站首页>Openresty accesses redis and MySQL
Openresty accesses redis and MySQL
2022-07-21 05:22:00 【dragonpeng2008】
15.1 lua-resty-redis External access redis cache
So let's talk about that lua-resty-redis Of lua Script writing .
15.1.1 Common methods
-- Inquire about key Value
local res, err = red:get("key")
-- Inquire about list Value
local res, err = red:lrange("nokey", 0, 1)
-- With json Format output value
ngx.say("res:",cjson.encode(res))
15.1.2 establish redis Connect
red, err = redis:new()
ok, err = red:connect(host, port, options_table?)
15.1.3 Set up timeout
red:set_timeout(time)
15.1.4 Set up keepalive
red:set_keepalive(max_idle_timeout, pool_size)
15.1.5 close redis Connect
ok, err = red:close()
15.1.6 Use pipeline Submit redis command
边栏推荐
- Leetcode力扣题解 - 30.串联所有单词的子串
- Entity annotation - batch generate 10000 test data
- Redis实现秒杀系统
- PO,BO,VO,DTO和POJO的概念区分
- 小程序毕设作品之微信运动场地预约小程序毕业设计(7)中期检查报告
- The difference between copy and copy in XMIND
- Daily question 1: specified interval reversal in the linked list
- Unicode encoding output 12 zodiac emoticons
- pypi 统计下载次数
- 1.54寸TFT ST7789液晶屏图片如何取模
猜你喜欢
【Verilog数字系统设计(夏宇闻)----Verilog的基础知识1】
接口遇到jsonString应该怎么处理
IO(1)-IO的分层
微信、QQ、电话下单,在线订货系统助企业走出困局
[Verilog digital system design (Xia Yuwen) -- basic knowledge of Verilog 1]
The difference between copy and copy in XMIND
年中总结及个人有感
不用线段树,一个思路解决所有我的日程安排表问题
Run keyword if usage details
Leetcode force deduction solution - 30 Concatenate substrings of all words
随机推荐
VS2017修改默认包含目录、库目录
go sync包
The LAAS protocol of defi 2.0 is the key to revitalizing the development of defi track
VRRP中的上层回的路由
extern 、static 作为全局变量的使用与差异
ASP.NET Core 使用记录2
[Verilog digital system design (Xia Yuwen) -- basic knowledge of Verilog 1]
Lua脚本语言入门
每日三题 7.16
470-82(200、1049、416、50)
Addition, deletion, query and modification of MySQL [advanced]
Duplicate class com.amap.api.fence.DistrictItem found in modules jetified-3dmap-9.3.1.jar (com.amap.
gcc unsed和used的作用
pytest + allure 结合使用展示图表结果(3)
AutoJs学习-实现透明状态栏
每日一题·731.我的日程安排表||·数组
Link file of Infineon aurix tc3xx Series MCU
[binary tree] rebuild the binary tree (find the root first, divide and conquer in the middle)
How JMeter fetches cookies jsession
小程序毕设作品之微信运动场地预约小程序毕业设计(8)毕业设计论文模板