分布式多级缓存

例子(测试环境)

项目结构图

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

测试结果为下:

相关推荐
刘一说2 小时前
深入理解 Spring Boot 中的 Redis 缓存集成:从基础配置到高可用实践
spring boot·redis·缓存
JJCar2 小时前
【Cache缓存】分配策略
缓存·cache·多核数据一致性
苦学编程的谢5 小时前
Redis_6_String
数据库·redis·缓存
墨染点香6 小时前
LeetCode 刷题【146. LRU 缓存】
leetcode·缓存·哈希算法
JanelSirry7 小时前
真实场景:防止缓存穿透 —— 使用 Redisson 布隆过滤器
数据库·mysql·缓存·redisson·布隆过滤器
埃泽漫笔7 小时前
Redis单线程还是多线程?
数据库·redis·缓存
WeiQ_13 小时前
解决phpstudy 8.x软件中php8.2.9没有redis扩展的问题
数据库·redis·缓存
JJCar19 小时前
【Cache缓存】cache的刷新
缓存·cache·多核数据一致性
老虎06271 天前
黑马点评学习笔记07(缓存工具封装)
笔记·学习·缓存
-Xie-1 天前
Redis(二)——数据类型二
数据库·redis·缓存