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
> написал:
>>
>> Вячеслав-
>>
>> 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<https://github.com/evanmiller/ChicagoBoss/wiki/DB-Adapter-Quickstart>
>>
>>
>> On 26 December 2012 23:49, Вячеслав Козлов <[email protected]> wrote:
>>
>>> Tell me, how can I use Eredis (Erlang Redis client) in my application CB.
>>> At least the main points.
>>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit
https://groups.google.com/d/msgid/chicagoboss/2738305e-5fc8-4b1f-a10b-8bb1e7ccefe0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.