随笔分类 -  语言类 / lua

nginx+lua乐观锁实现秒杀
摘要:package.path = '/class_goods/nginx/lua/5.1/lua-redis-cluster-master/?.lua;;/class_goods/nginx/lua/5.1/lua-resty-redis/lib/?.lua;;/class_goods/nginx/lu 阅读全文

posted @ 2021-07-08 10:23 木林coder 阅读(430) 评论(0) 推荐(0) 编辑

秒杀
摘要:package.path = '/class_goods/nginx/lua/5.1/lua-redis-cluster-master/?.lua;;/class_goods/nginx/lua/5.1/lua-resty-redis/lib/?.lua;;/class_goods/nginx/lu 阅读全文

posted @ 2021-07-06 09:19 木林coder 阅读(122) 评论(0) 推荐(0) 编辑

分发服务器-set.lua
摘要:--写业务逻辑 local flag=ngx.shared.load:get("load") local load_blance='' if tonumber(flag) == 1 then load_blance="upstream_server_round" elseif tonumber(fl 阅读全文

posted @ 2021-03-10 18:02 木林coder 编辑

分发服务器-init.lua
摘要:--进程启动触发 local delay = 5 local handler handler = function (premature) local resty_consul = require('resty.consul') local consul = resty_consul:new({ h 阅读全文

posted @ 2021-03-10 17:57 木林coder 阅读(104) 评论(0) 推荐(0) 编辑

filter.lua
摘要:local ngx_re_split=require("ngx.re").split local ip_addr = ngx.shared.redis_cluster_addr:get('redis-addr') ip_addr = ngx_re_split(ip_addr,',') local r 阅读全文

posted @ 2021-03-09 20:19 木林coder 阅读(134) 评论(0) 推荐(0) 编辑

cache.lua--自带加锁功能方式缓存击穿
摘要:local key = ngx.re.match(ngx.var.request_uri,"/([0-9]+).html") local mlcache = require "resty.mlcache" local function fetch_shop(aaa) ngx.log(ngx.ERR, 阅读全文

posted @ 2021-03-07 18:46 木林coder 阅读(169) 评论(0) 推荐(0) 编辑

aapplication.lua
摘要:-- ngx.header_content_type='text/plain' --ngx.say(123) local ngx_re_split=require("ngx.re").split local ip_addr = ngx.shared.redis_cluster_addr:get('r 阅读全文

posted @ 2021-03-07 15:42 木林coder 阅读(88) 评论(0) 推荐(0) 编辑

init.lua
摘要:local delay = 5 local handler handler = function (premature) --ngx.log(ngx.ERR," timer-do") local resty_consul = require('resty.consul') local consul 阅读全文

posted @ 2021-03-07 15:41 木林coder 阅读(566) 评论(0) 推荐(0) 编辑

lock.lua
摘要:local rety_lock = require "resty.lock" local cache = ngx.shared.my_cache local key = ngx.re.match(ngx.var.request_uri,"/([0-9]+).html") if type(key) = 阅读全文

posted @ 2021-03-07 15:40 木林coder 阅读(196) 评论(0) 推荐(0) 编辑

ngx-lua相关命令
摘要:nginx文件 lua_code_cache off; content_by_lua_file /usr/local/openresty/lualib/project/grays/grays.lua; lua文件 ngx.header.content_type="text/plain"; ngx.s 阅读全文

posted @ 2021-02-26 20:23 木林coder 阅读(62) 评论(0) 推荐(0) 编辑

六星lua安装
摘要:wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz tar -zxvf LuaJIT-2.0.5.tar.gz cd LuaJIT-2.0.5 make && make install PREFIX=/usr/local/LuaJIT export 阅读全文

posted @ 2021-02-25 11:20 木林coder 阅读(71) 评论(0) 推荐(0) 编辑

lua 安装
摘要:https://www.cnblogs.com/chy123/p/6752117.html https://www.runoob.com/lua/lua-environment.html 阅读全文

posted @ 2020-11-18 21:32 木林coder 阅读(53) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示