德玛西亚99
用ERedis:下载和编译:cd eredis./rebar compile在console中使用:erl -pa ebin/{ok, C} = eredis:start_link().{ok, <<"OK">>} = eredis:q(C, ["SET", "foo", "bar"]).{ok, <<"bar">>} = eredis:q(C, ["GET", "foo"]).在模块中使用:[plain] view plain copy save_order_id({Pid, DynData}) -> {ok, Rds} = eredis:start_link(), {_,Val} = ts_dynvars:lookup(order_id, DynData), Id = binary_to_list(Val), {ok, _} = eredis:q(Rds, ["RPUSH", "order_list", Id]). get_order_id({Pid, DynData}) -> {ok, Rds} = eredis:start_link(), {ok, Id} = eredis:q(Rds, ["LPOP", "order_list"]), Id.