Re: [chicagoboss] ChicagoBoss Eredis

115 views
Skip to first unread message

Tim McNamara

unread,
Dec 26, 2012, 4:52:54 PM12/26/12
to chica...@googlegroups.com
Вячеслав-

External dependencies live in /include/. Otherwise you can add them to rebar.

Do any initialisation work in an init/0 function in /priv/init/ that returns {ok, ListOfWatchIDs}. See the other modules in that directory for examples.

You can now use ERedis anywhere in your project as per normal. If you want to use boss_db though, you need to build a DB adapter

On 26 December 2012 23:49, Вячеслав Козлов <kozl...@gmail.com> wrote:
Tell me, how can I use Eredis (Erlang Redis client) in my application CB.
At least the main points.

jiale.chan

unread,
Feb 9, 2014, 3:31:03 AM2/9/14
to chica...@googlegroups.com
Hi,

i add some code to init/0 :

init() ->
    {ok, C} = eredis:start_link("127.0.0.1", "6379").
    {ok, [C]}.

and my controller:

homepage('GET', []) ->
    {ok, <<"OK">>} = eredis:q(C, ["SET", "foo", "bar"]),
    {ok, <<"bar">>} = eredis:q(C, ["GET", "foo"]),
    {output, "<strong>hello!</strong>"}.

but i got a error message:

    unbound_var,'C'

how can i get the handler  which is return by init/0 from my controller?

newbie need you help, TXH.

在 2012年12月27日星期四UTC+8下午1时23分39秒,Вячеслав Козлов写道:
Thank you, Tim!
I decided this question. And it was very easy!
I did it this way - thanks to your tip, made the traditional way, with rebar, rebar.config added in relation to Eredis GIT, then in path /src/ downloaded eredis, added a my module gen-server that implements the API for my work with Eredis .
And all! Everything was pretty easy!
If anyone is interested, I can not describe in detail.

четверг, 27 декабря 2012 г., 1:52:54 UTC+4 пользователь Tim McNamara написал:
Reply all
Reply to author
Forward
0 new messages