-module(test). -export([ main/0 ]). unwrap({ok, [{_, V}]}) -> V; %% ok unwrap(_) -> err. %% not ok main() -> %Conn = {host, "localhost", port, 11211}, Conn = {host, "127.0.0.1", port, 11211}, R0 = memcached:get(Conn, "test1"), %% {ok,[]} io:format("get test1 = ~p~n", [R0]), V1 = "value1 = 🔥🦀", R1 = memcached:set(Conn, "test1", V1), %% ok = stored successfully io:format("set test1 = ~p~n", [R1]), R2 = memcached:get(Conn, "test1"), %% {ok,[{"test1",[118,97,108,117,101,49,32,61,32,128293,129408]}]} io:format("get test1 = ~ts~n", [ unwrap(R2) ]), %% value1 = 🔥🦀 R3 = memcached:delete(Conn, "test1"), %% ok io:format("delete test1 = ~p~n", [R3]), R4 = memcached:get(Conn, "test1"), %% {ok,[]} io:format("get test1 = ~p~n", [R4]), ok.