anchor.diff:             #mc_entry{flag = Flag, expire = Expire} = Entry, Opcode) ->
       Ext = <<Flag:32, Expire:32>>,
       send_recv(Sock, RecvCallback,
  -              #mc_header{opcode = Opcode}, Entry#mc_entry{ext = Ext}).
  +              #mc_header{opcode = Opcode}, Entry#mc_entry{ext = Ext},
  +              <<"STORED">>).
   
   get_recv(Sock, RecvCallback) ->
       case recv(Sock, res) of
           {error, _} = Err -> Err;
  -        {ok, _Entry, #mc_header{opcode = ?NOOP}} ->
  +        {ok, #mc_header{opcode = ?NOOP}, _Entry} ->
               {ok, <<"END">>};
  -        {ok, Entry, #mc_header{opcode = ?GETKQ} = Header} ->
  -            if is_function(RecvCallback) -> RecvCallback(Header, Entry);
  -               true -> ok
  +        {ok, #mc_header{opcode = ?GETKQ} = Header, Entry} ->
  +            case is_function(RecvCallback) of
  +               true  -> RecvCallback(Header, Entry);
  +               false -> ok
               end,
               get_recv(Sock, RecvCallback)
       end.
   
  +send_recv(Sock, RecvCallback, Header, Entry, Success) ->
  +    {ok, RecvHeader, _RecvEntry} = send_recv(Sock, RecvCallback, Header, Entry),
  +    V1 = RecvHeader#mc_header.opcode,
  +    V1 = Header#mc_header.opcode,
  +    V2 = RecvHeader#mc_header.statusOrReserved,
  +    V2 = ?SUCCESS,
  +    {ok, Success}.
  +
   send_recv(Sock, RecvCallback, Header, Entry) ->
       ok = send(Sock, req, Header, Entry),
       {ok, RecvHeader, RecvEntry} = recv(Sock, res),
  -    if is_function(RecvCallback) -> RecvCallback(RecvHeader, RecvEntry);
  -       true -> ok
  +    case is_function(RecvCallback) of
  +       true  -> RecvCallback(RecvHeader, RecvEntry);
  +       false -> ok
       end,
       {ok, RecvHeader, RecvEntry}.
   
  
positive.code: %     cmd_update(Sock, RecvCallback, Entry, ?PREPEND);
  
  % cmd(incr, Sock, RecvCallback, Entry) ->
  %     send_recv(Sock, RecvCallback, Entry, ?INCREMENT);
  % cmd(decr, Sock, RecvCallback, Entry) ->
  %     send_recv(Sock, RecvCallback, Entry, ?DECREMENT);
  
  cmd(delete, Sock, RecvCallback, Entry) ->
      send_recv(Sock, RecvCallback, #mc_header{opcode = ?DELETE}, Entry);
  
  cmd(flush_all, Sock, RecvCallback, Entry) ->
      send_recv(Sock, RecvCallback, #mc_header{opcode = ?FLUSH}, Entry);
  
  cmd(Opcode, Sock, RecvCallback, Entry) ->
      % Dispatch to cmd_binary() in case the caller was
  
negative.code:     {ok, Sock} = gen_tcp:connect("localhost", 11211,
                                   [binary, {packet, 0}, {active, false}]),
      (fun () ->
          {ok, works} = send_recv(Sock, nil,
                                  #mc_header{opcode = ?NOOP}, #mc_entry{},
                                  works)
      end)(),
  
      test_flush(Sock),
  
      ok = gen_tcp:close(Sock).
  
  test_flush(Sock) ->
      {ok, works} = send_recv(Sock, nil,
                              #mc_header{opcode = ?FLUSH}, #mc_entry{}, works).
  
      % (fun () ->
      %     {ok, RB1} = send_recv(Sock, <<"get ", Key/binary, "\r\n">>, nil),
      %     ?assertMatch(RB1, <<"END">>)
      % end)(),
  
  set_test() ->
      {ok, Sock} = gen_tcp:connect("localhost", 11211,
                                   [binary, {packet, 0}, {active, false}]),
      set_test_sock(Sock, <<"aaa">>),
      ok = gen_tcp:close(Sock).
  
  set_test_sock(Sock, Key) ->
      test_flush(Sock),
  
      (fun () ->
          {ok, RB} = cmd(set, Sock, nil,
                         #mc_entry{key = Key,
                                   data = <<"AAA">>}),
          ?assertMatch(RB, <<"STORED">>)
  
          % get_test_match(Sock, Key, <<"AAA">>)
      end)().
  