Skip to content

Latest commit

 

History

History
59 lines (34 loc) · 1.24 KB

lua_shared_dict.md

File metadata and controls

59 lines (34 loc) · 1.24 KB

lua_shared_dict

语法: lua_shared_dict <name> <size>

默认: no

环境: http

阶段: depends on usage

声明一个共享内存区块 <name>,用来存储基于共享内存的 Lua 字典 ngx.shared.<name>

在当前 Nginx 服务器实例中,共享内存区块被所有 nginx worker 进程共享。

<size> 参数可以通过类似 km 的大小单位来设置。

 http {
     lua_shared_dict dogs 10m;
     ...
 }

更多细节请参考 ngx.shared.DICT

这个指令最早出现在版本 v0.3.1rc22 中。

English Source

syntax: lua_shared_dict <name> <size>

default: no

context: http

phase: depends on usage

Declares a shared memory zone, <name>, to serve as storage for the shm based Lua dictionary ngx.shared.<name>.

Shared memory zones are always shared by all the nginx worker processes in the current nginx server instance.

The <size> argument accepts size units such as k and m:

 http {
     lua_shared_dict dogs 10m;
     ...
 }

See ngx.shared.DICT for details.

This directive was first introduced in the v0.3.1rc22 release.

返回目录