分布式多级缓存

例子(测试环境)

项目结构图

运行反向代理服务器也就是负责反向代理到三个nginx的nginx,该nignx也负责前端页面的跳转。

该nginx的conf为下:

突出位置就是该nginx需要反向代理的其他nginx的IP和端口。

Lua语法

linux安装Lua

复制代码
#安装lua环境
apt install lua 5.3

测试Lua是否安装成功

变量,循环,函数

变量

可以通过函数 type()来判断变量的类型

创建一个后缀为lua的文件编写格式为下(--表示注释, local表示局部变量):

Lua 复制代码
local string = "hello, world!" --字符串
local table  = {name = "秃狼", age = 18} --对象
local arr = {"red", "blue", "yellow"} --数组

function say(arr) --自定义函数
        for index, value in ipairs(arr) do
                print( index, value)
        end
end


say(arr)
print(string)
print(table)

进行测试 lua "对应的文件名" 指令运行,测试结果为下:

条件控制和逻辑判断

对应的格式为下:

Lua 复制代码
local yes = true
  
if yes then
        print("成功了!!!!!!!!!")
else
        print("失败了!!!!!!!!!")
end

if not yes then
        print("失败了。。。。。。")
else
        print("成功了。。。。。。")
end

测试结果为下:

相关推荐
一写代码就开心12 小时前
redis-cli 客户端查询set集合里面的具体数据
数据库·redis·缓存
S1998_1997111609•X12 小时前
针对犯罪集团etc/all,pid,IP的规划及量化逻辑原理
网络·安全·百度·缓存·量子计算
Irissgwe14 小时前
redis之典型应用-缓存cache
数据库·redis·缓存·缓存击穿·缓存雪崩·redis淘汰策略
无盐海18 小时前
Foundatio,内存,Redis 缓存
数据库·redis·缓存
shark-chili19 小时前
基于claude code的redis慢查询指令复刻实践
数据库·redis·缓存
xu_ws19 小时前
spring通过三级缓存解决循环依赖
java·spring·缓存·循环依赖
IronMurphy20 小时前
Redis拷打第二讲
数据库·redis·缓存
手握风云-20 小时前
Redis:不只是缓存那么简单(八)
redis·缓存
phltxy21 小时前
Redis Set:原理、命令与实战场景详解
数据库·redis·缓存
橙子圆12321 小时前
Redis知识5之持久化
数据库·redis·缓存