aboutsummaryrefslogtreecommitdiffstats
path: root/core/moduleapi.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-07-30 00:40:02 +0100
committerMatthew Wild <mwild1@gmail.com>2012-07-30 00:40:02 +0100
commitdfd02c4577869306c3e9e55685b6aa1bcfb45d69 (patch)
treeeac33cd161991ab2803d027c6860352f60749f07 /core/moduleapi.lua
parent8578efc0b92626d53535ff04d146b050a50a61da (diff)
downloadprosody-dfd02c4577869306c3e9e55685b6aa1bcfb45d69.tar.gz
prosody-dfd02c4577869306c3e9e55685b6aa1bcfb45d69.zip
moduleapi: If path name ends with '-cache' create table as weak (keys and values)
Diffstat (limited to 'core/moduleapi.lua')
-rw-r--r--core/moduleapi.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index 54077826..c98a7e4b 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -155,6 +155,9 @@ function api:shared(...)
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 @@ function api:load_resource(path, mode)
return io.open(path, mode);
end
-return api; \ No newline at end of file
+return api;