分布式多级缓存

例子(测试环境)

项目结构图

运行反向代理服务器也就是负责反向代理到三个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

测试结果为下:

相关推荐
stevenzqzq11 小时前
android recyclerview缓存2_四级缓存机制
android·spring boot·缓存
q***d17312 小时前
后端缓存技术学习资源,Redis+Memcached
redis·学习·缓存
麦兜*13 小时前
Redis在Web3中的应用探索:作为链下状态缓存与索引层
java·spring boot·redis·spring cloud·缓存·docker·web3
qwer12321ck761 天前
Maven在本地仓库缓存了失败的下载记录
缓存·maven
百***6971 天前
redis 使用
数据库·redis·缓存
爬山算法1 天前
Redis(124)Redis在电商系统中的应用有哪些?
数据库·redis·缓存
Dontla1 天前
React useMemo(当依赖项未变化,重复渲染时直接返回上一次缓存计算结果,而非重新执行计算)
前端·react.js·缓存
kong79069282 天前
SpringCache缓存
java·spring·缓存
4***14902 天前
后端分布式缓存集群,Redis Sentinel
redis·分布式·缓存
瑞思蕊萌2 天前
redis实战篇--商品缓存模块
数据库·redis·缓存