Skip to content

Instantly share code, notes, and snippets.

@ir4y
Created September 9, 2013 14:07
Show Gist options
  • Select an option

  • Save ir4y/6496066 to your computer and use it in GitHub Desktop.

Select an option

Save ir4y/6496066 to your computer and use it in GitHub Desktop.
-module(session).
-export([run/0]).
run() ->
{ok, C} = eredis:start_link(),
{ok, Session} = eredis:q(C, ["GET", "session:l7nruerw7i9tp3fr461q0lrbej72q5er"]),
String =erlang:binary_to_list(base64:decode(Session)),
Tokens = string:tokens(String,":"),
SessionValue = lists:nth(2,Tokens),
Term = pickle:pickle_to_term(erlang:list_to_binary(SessionValue)),
{ok, {pickle_unicode, Foo}} = dict:find(<<"foo">>,Term),
io:format(Foo).
%{deps, [
% {pickle, ".*", {git, "https://github.com/jdavisp3/pickle.git"}},
% {eredis, ".*", {git, "https://github.com/wooga/eredis.git"}}
% ]}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment