anchor.diff:  %% @end
   %%--------------------------------------------------------------------
   -spec apply(batch()) -> batch().
  -apply(Batch = #batch{cache = Cache}) ->
  -    Requests = maps:fold(fun
  -        (Key, #entry{ctx = Ctx, doc = Doc, status = pending}, Acc) ->
  -            [{Ctx, Key, Doc} | Acc];
  -        (_Key, _Entry, Acc) ->
  -            Acc
  -    end, [], Cache),
  +apply(Batch = #batch{cache = Cache, cache_mod_keys = CMK}) ->
  +    Requests = lists:foldl(fun(Key, Acc) ->
  +        case maps:get(Key, Cache, undefined) of
  +            #entry{ctx = Ctx, doc = Doc, status = pending} ->
  +                [{Ctx, Key, Doc} | Acc];
  +            _ ->
  +                Acc
  +        end
  +    end, [], CMK),
       {_, Keys, _} = lists:unzip3(Requests),
       Responses = datastore_cache:save(Requests),
       Statuses = lists:map(fun
  
positive.code: %%--------------------------------------------------------------------
  -spec save(ctx(), key(), doc(), batch()) -> {{ok, doc()}, batch()}.
  save(Ctx, Key, Doc, Batch = #batch{
      cache = Cache, requests = Requests, request_ref = Ref
  }) ->
      Keys = maps:get(Ref, Requests, []),
      Entry = #entry{ctx = Ctx, doc = Doc, status = pending},
      {{ok, Doc}, Batch#batch{
          requests = maps:put(Ref, [Key | Keys], Requests),
          cache = maps:put(Key, Entry, Cache)
      }}.
  
  %%--------------------------------------------------------------------
  
negative.code:         Batch2#batch{
              cache = maps:put(Key, Entry#entry{status = Status}, Cache2)
          }
      end, Batch#batch{cache_mod_keys = []}, lists:zip(Keys, Statuses)).
  
  %%--------------------------------------------------------------------
  %% @doc
  