Software /
code /
prosody
Diff
core/moduleapi.lua @ 5053:375ab71e4b37
moduleapi: If path name ends with '-cache' create table as weak (keys and values)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 30 Jul 2012 00:40:02 +0100 |
parent | 5024:d25e1b9332cc |
child | 5077:6c2c8bf36d22 |
line wrap: on
line diff
--- a/core/moduleapi.lua Sun Jul 29 22:21:58 2012 +0200 +++ b/core/moduleapi.lua Mon Jul 30 00:40:02 2012 +0100 @@ -155,6 +155,9 @@ local shared = shared_data[path]; if not shared then shared = {}; + if path:match("%-cache$") then + setmetatable(shared, { __mode = "kv" }); + end shared_data[path] = shared; end t_insert(data_array, shared); @@ -336,4 +339,4 @@ return io.open(path, mode); end -return api; \ No newline at end of file +return api;