anchor.diff:          [] -> {noreply, State};
           Cs ->
               lager:debug("flushing metric cache of ~p (~w entries)",
  -                        [State#state.path, length(Cs)]),
  +                        [State#state.path, State#state.cache_size]),
   
               File = State#state.fspath,
               case statser_whisper:update_points(File, Cs) of
                   ok ->
  -                    statser_instrumentation:increment(<<"committed-points">>, length(Cs)),
  -                    {noreply, State#state{cache=[]}};
  +                    statser_instrumentation:increment(<<"committed-points">>, State#state.cache_size),
  +                    {noreply, State#state{cache=[], cache_size=0}};
                   _Error ->
                       % archive is not existing (yet)
                       % so dispatch a creation via rate-limiter
  
positive.code:     ].
  
  cache_sorted_test_() ->
      [?_assertEqual([{120, 10}, {110, 10}, {100, 10}],
                    cache_sorted(10, 120, [{110, 10}, {100, 10}])),
       ?_assertEqual([{120, 10}, {110, 10}, {100, 10}],
                    cache_sorted(10, 110, [{120, 10}, {100, 10}])),
       ?_assertEqual([{120, 10}, {110, 10}, {100, 10}],
                    cache_sorted(10, 100, [{120, 10}, {110, 10}])),
       ?_assertEqual([{120, 11}, {110, 10}],
                    cache_sorted(11, 120, [{120, 10}, {110, 10}])),
       ?_assertEqual([{120, 10}, {110, 11}],
                    cache_sorted(11, 110, [{120, 10}, {110, 10}]))
      ].
  
  
  merge_with_cache_test_() ->
      Cache = cache_sorted(16, 160, [{120, 12}, {110, 11}, {100, 10}]),
      Test = fun(Values) ->
                     Series = #series{values=Values},
                     merge_with_cache(Series, Cache)
  
negative.code:     NewState = cache_point(Value, TS, State),
  
      % TODO: more dynamic flush interval
      if NewState#state.cache_size > ?MIN_CACHE_ENTRIES ->
             gen_server:cast(self(), flush_cache);
         true -> ok
      end,
  