@@ -16,10 +16,10 @@ local concat = table.concat
1616local setmetatable = setmetatable
1717local pcall = pcall
1818
19- local tab_new = require (' table.new' )
2019local isempty = require (' table.isempty' )
2120
22- local manifests_cache = tab_new (32 , 0 )
21+ -- Module-level cache storage (one per worker process)
22+ local manifests_cache = {}
2323
2424local _M = {}
2525
@@ -75,7 +75,11 @@ local function lua_load_path(load_path)
7575 return format (' %s/?.lua' , load_path )
7676end
7777
78- local function get_manifest (name , version )
78+ -- Get a cached manifest by policy name and version
79+ -- @tparam string name The policy name
80+ -- @tparam string version The policy version
81+ -- @treturn table|nil The cached manifest table, or nil if not cached
82+ local function get_cached_manifest (name , version )
7983 local manifests = manifests_cache [name ]
8084 if manifests then
8185 for _ , manifest in ipairs (manifests ) do
@@ -87,7 +91,7 @@ local function get_manifest(name, version)
8791end
8892
8993local function load_manifest (name , version , path )
90- local manifest = get_manifest (name , version )
94+ local manifest = get_cached_manifest (name , version )
9195 if not manifest then
9296 manifest = read_manifest (path )
9397 end
0 commit comments