25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

Use disc_only_copies for oauth_token Mnesia table

This commit is contained in:
Evgeniy Khramtsov 2017-05-17 17:42:22 +03:00
parent 8f595b58a7
commit 1391d5a304

View File

@ -29,17 +29,28 @@
-export([init/0, -export([init/0,
store/1, store/1,
lookup/1, lookup/1,
clean/1]). clean/1,
use_cache/0]).
-include("ejabberd_oauth.hrl"). -include("ejabberd_oauth.hrl").
init() -> init() ->
ejabberd_mnesia:create(?MODULE, oauth_token, ejabberd_mnesia:create(?MODULE, oauth_token,
[{disc_copies, [node()]}, [{disc_only_copies, [node()]},
{attributes, {attributes,
record_info(fields, oauth_token)}]), record_info(fields, oauth_token)}]),
ok. ok.
use_cache() ->
case mnesia:table_info(oauth_token, storage_type) of
disc_only_copies ->
ejabberd_config:get_option(
oauth_use_cache,
ejabberd_config:use_cache(global));
_ ->
false
end.
store(R) -> store(R) ->
mnesia:dirty_write(R). mnesia:dirty_write(R).