anchor.diff:                end,
               gen_server:reply(From, Res)
       end),
  -  {noreply, State}.
  +  {noreply, State#state{redis = Redis ++ [RedisConn]}}.
   
   %% @hidden
   -spec handle_cast(_, state()) -> {noreply, state()}.
  
positive.code: 
  -include("match_stream.hrl").
  
  -record(state, {redis :: pid()}).
  -opaque state() :: #state{}.
  
  -export([create/1, update/2, all/0, get/1, delete/1, log/1, history/1]).
  
negative.code:     {throw, Exception} -> throw(Exception)
    end.
  
  -spec handle_call(term(), pid()) -> term().
  handle_call({create, Match}, RedisConn) ->
    Key = <<"match-", (Match#match_stream_match.match_id)/binary>>,
    case erldis:get(RedisConn, Key) of
      nil ->
        case erldis:set(RedisConn, Key, Match) of
          ok -> ok;
          Error -> throw(Error)
        end;
      _ ->
        throw(duplicated)
    end;
  handle_call({update, MatchId, UpdateFun}, RedisConn) ->
    Key = <<"match-", MatchId/binary>>,
    case erldis:get(RedisConn, Key) of
      nil ->
        throw(not_found);
      MatchBin ->
        case erldis:set(RedisConn, Key, UpdateFun(erlang:binary_to_term(MatchBin))) of
          ok -> ok;
          Error -> throw(Error)
        end
    end;
  handle_call({delete, MatchId}, RedisConn) ->
    Key = <<"match-", MatchId/binary>>,
    _Removed = erldis:del(RedisConn, Key),
    Keys =
      case erldis:keys(RedisConn, "event-" ++ binary_to_list(MatchId) ++ "-*") of
        [] -> [];
        [Bin1] -> binary:split(Bin1, <<" ">>, [global, trim]);
        Ids -> Ids
      end,
    _RemovedEvents = erldis:delkeys(RedisConn, Keys),
    ok;
  handle_call({log, Event}, RedisConn) ->
    MatchKey = <<"match-", (Event#match_stream_event.match_id)/binary>>,
    case erldis:get(RedisConn, MatchKey) of
      nil ->
        throw(not_found);
      _Match ->
        Key = <<"event-", (Event#match_stream_event.match_id)/binary, $-,
                (list_to_binary(integer_to_list(Event#match_stream_event.timestamp)))/binary>>,
        case erldis:set(RedisConn, Key, Event) of
          ok -> ok;
          Error -> throw(Error)
        end
    end;
  handle_call(all, RedisConn) ->
    Res =
      case erldis:keys(RedisConn, "match-*") of
        [] -> [];
        [Bin1] -> binary:split(Bin1, <<" ">>, [global, trim]);
        Ids -> Ids
      end,
    lists:map(fun(<<"match-", MatchId/binary>>) -> MatchId end, Res);
  handle_call({history, MatchId}, RedisConn) ->
    Keys =
      case erldis:keys(RedisConn, "event-" ++ binary_to_list(MatchId) ++ "-*") of
        [] -> [];
        [Bin1] -> binary:split(Bin1, <<" ">>, [global, trim]);
        Ids -> Ids
  