webmachine

How can I make Webmachine and eredis work together?

巧了我就是萌 提交于 2019-12-12 09:07:14
问题 I've been meditating on the question of Redis usage in my Webmachine application for a week. And I haven't enlightened yet. I'm going to use Eredis and here is an example of usage: {ok, Con} = eredis:start_link(). {ok, <<"OK">>} = eredis:q(Con, ["SET", "foo", "bar"]). {ok, <<"bar">>} = eredis:q(Con, ["GET", "foo"]). As I understand eredis:start_link() should be called somewhere only once. But then how can I get Con variable in my resources? 回答1: There are several solutions: register a redis

How can I make Webmachine and eredis work together?

青春壹個敷衍的年華 提交于 2019-12-04 15:28:52
I've been meditating on the question of Redis usage in my Webmachine application for a week. And I haven't enlightened yet. I'm going to use Eredis and here is an example of usage: {ok, Con} = eredis:start_link(). {ok, <<"OK">>} = eredis:q(Con, ["SET", "foo", "bar"]). {ok, <<"bar">>} = eredis:q(Con, ["GET", "foo"]). As I understand eredis:start_link() should be called somewhere only once. But then how can I get Con variable in my resources? There are several solutions: register a redis connection locally or globally use a process register like gproc keep the pid of the connection in the