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 | a515ffa5e3ebd1503d1a609186c87fafebde5d37 (patch) | |
tree | eac33cd161991ab2803d027c6860352f60749f07 /core/moduleapi.lua | |
parent | dbfa0c8ce730075cca0ebbc1299b98708be75978 (diff) | |
download | prosody-a515ffa5e3ebd1503d1a609186c87fafebde5d37.tar.gz prosody-a515ffa5e3ebd1503d1a609186c87fafebde5d37.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.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; |