redisに接続するために、Erlang プロジェクトにedisを含めようとしています。私はそれを lib/ ディレクトリに置き、使用しまし-include_lib ("../lib/eredis/include/eredis.hrl").
た。erl
** exception error: undefined function eredis:start_link/0
redis_worker.erl:
-module (redis_worker).
-export ([get/2, set/3, client/0]).
-include_lib ("../lib/eredis/include/eredis.hrl").
client() ->
eredis:start_link().
get(Client, Key) when is_list(Key) ->
{ok, Val} = eredis:q(Client,["GET", Key]),
io:format("Got key: ~s which had value ~s~n", [Key, Val]).
set(Client, Key, Value) when is_list(Key) andalso is_list(Value)->
{ok, <<"OK">>} = eredis:q(Client, ["SET", Key, Value]),
io:format("Set key: ~s to ~s~n",[Key, Value]).
正常にコンパイルされるのはなぜですか (これは を実行することを意味すると思いますinclude_lib
)、含まれているライブラリを使用しようとすると爆発しますか?