{deps, [{lager, ".*", {git, "https://github.com/erlang-lager/lager", "3.6.10"}},
{p1_utils, ".*", {git, "https://github.com/processone/p1_utils", "2887223"}},
- {cache_tab, ".*", {git, "https://github.com/processone/cache_tab", "f3d8376"}},
+ {cache_tab, ".*", {git, "https://github.com/processone/cache_tab", "01e0f33"}},
{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.1.1"}}},
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.16"}}},
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", "7fd02f3a2f"}},
cache_opts(Opts) ->
[{max_size, mod_stream_mgmt_opt:cache_size(Opts)},
- {life_time, infinity}].
+ {life_time, mod_stream_mgmt_opt:cache_life_time(Opts)},
+ {type, ordered_set}].
-spec store_stanzas_in(ljid(), erlang:timestamp(), non_neg_integer()) -> boolean().
store_stanzas_in(LJID, Time, Num) ->
pop_stanzas_in(LJID, Time) ->
case ets_cache:lookup(?STREAM_MGMT_CACHE, {LJID, Time}) of
{ok, Val} ->
- ets_cache:delete(?STREAM_MGMT_CACHE, {LJID, Time},
- ejabberd_cluster:get_nodes()),
+ ets_cache:match_delete(?STREAM_MGMT_CACHE, {LJID, '_'},
+ ejabberd_cluster:get_nodes()),
{ok, Val};
error ->
error
econf:bool());
mod_opt_type(cache_size) ->
econf:pos_int(infinity);
+mod_opt_type(cache_life_time) ->
+ econf:timeout(second, infinity);
mod_opt_type(queue_type) ->
econf:queue_type().
{max_resume_timeout, undefined},
{ack_timeout, timer:seconds(60)},
{cache_size, ejabberd_option:cache_size(Host)},
+ {cache_life_time, timer:hours(48)},
{resend_on_timeout, false},
{queue_type, ejabberd_option:queue_type(Host)}].
-module(mod_stream_mgmt_opt).
-export([ack_timeout/1]).
+-export([cache_life_time/1]).
-export([cache_size/1]).
-export([max_ack_queue/1]).
-export([max_resume_timeout/1]).
ack_timeout(Host) ->
gen_mod:get_module_opt(Host, mod_stream_mgmt, ack_timeout).
+-spec cache_life_time(gen_mod:opts() | global | binary()) -> 'infinity' | pos_integer().
+cache_life_time(Opts) when is_map(Opts) ->
+ gen_mod:get_opt(cache_life_time, Opts);
+cache_life_time(Host) ->
+ gen_mod:get_module_opt(Host, mod_stream_mgmt, cache_life_time).
+
-spec cache_size(gen_mod:opts() | global | binary()) -> 'infinity' | pos_integer().
cache_size(Opts) when is_map(Opts) ->
gen_mod:get_opt(cache_size, Opts);