diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-07-30 00:40:02 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-07-30 00:40:02 +0100 |
commit | dfd02c4577869306c3e9e55685b6aa1bcfb45d69 (patch) | |
tree | eac33cd161991ab2803d027c6860352f60749f07 | |
parent | 8578efc0b92626d53535ff04d146b050a50a61da (diff) | |
download | prosody-dfd02c4577869306c3e9e55685b6aa1bcfb45d69.tar.gz prosody-dfd02c4577869306c3e9e55685b6aa1bcfb45d69.zip |
moduleapi: If path name ends with '-cache' create table as weak (keys and values)
-rw-r--r-- | core/moduleapi.lua | 5 |
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; |