./ct_report/coverage/mongoose_redis.COVER.html

1 -module(mongoose_redis).
2 -author("bartlomiej.gorny@erlang-solutions.com").
3
4 %% API
5 -export([cmd/1, cmd/2, cmds/1, cmds/2]).
6
7 -ignore_xref([cmd/2, cmds/2]).
8
9 -include_lib("eredis/include/eredis.hrl").
10
11 %%%===================================================================
12 %%% API
13 %%%===================================================================
14
15 -spec cmd(iolist()) -> undefined
16 | binary()
17 | [binary() | [binary() | integer()] | integer() | {'error', _}]
18 | integer()
19 | {'error', _}.
20 cmd(Cmd) ->
21 79734 cmd(Cmd, 5000).
22
23 -spec cmds([iolist()]) -> undefined
24 | binary()
25 | [binary() | [binary() | integer()] | integer() | {'error', _}]
26 | integer()
27 | {'error', _}.
28 cmds(Cmd) ->
29 16950 cmds(Cmd, 5000).
30
31 -spec cmd(iolist(), integer()) -> return_value() | {error, _}.
32 cmd(Cmd, Timeout) ->
33 79734 {ok, Worker} = mongoose_wpool:get_worker(redis, global, default),
34 79734 case eredis:q(Worker, Cmd, Timeout) of
35 79734 {ok, Value} -> Value;
36
:-(
V -> V
37 end.
38
39 -spec cmds([iolist()], integer()) ->
40 [{ok, return_value()} | {error, Reason::binary()}] | {error, no_connection}.
41 cmds(Cmd, Timeout) ->
42 16950 {ok, Worker} = mongoose_wpool:get_worker(redis, global, default),
43 16950 eredis:qp(Worker, Cmd, Timeout).
Line Hits Source