anchor.diff:  
   -define(MIN_CACHE_ENTRIES, 5).
   
  --record(state, {path, dirs, file, fspath, metadata, cache=[]}).
  +-record(state, {path, dirs, file, fspath, metadata, cache=[], cache_size=0}).
   
   %%%===================================================================
   %%% API
  
positive.code:         [] -> {noreply, State};
          Cs ->
              lager:debug("flushing metric cache of ~p (~w entries)",
                          [State#state.path, length(Cs)]),
  
              File = State#state.fspath,
              case statser_whisper:update_points(File, Cs) of
                  ok ->
                      statser_instrumentation:increment(<<"committed-points">>, length(Cs)),
                      {noreply, State#state{cache=[]}};
                  _Error ->
                      % archive is not existing (yet)
                      % so dispatch a creation via rate-limiter
  
negative.code:     case State#state.metadata of
          #whisper_metadata{archives=[A | _]} ->
              AlignedTS = TS - (TS rem A#whisper_archive.seconds),
              {Cache, Added} = cache_sorted(Value, AlignedTS, State#state.cache),
              CacheSize = State#state.cache_size + Added,
              State#state{cache=Cache, cache_size=CacheSize};
          _Otherwise ->
              State
      end.
  
  
  cache_sorted(Value, TS, []) ->
      {[{TS, Value}], 1};
  cache_sorted(Value, TS, Cache) ->
      cache_sorted(Value, TS, Cache, []).
  
  cache_sorted(Value, TS, [], Acc) ->
      {lists:reverse(Acc) ++ [{TS, Value}], 1};
  cache_sorted(Value, TS, [{TS1, _}=P | Ps]=Pss, Acc) ->
      if TS == TS1 ->
             {lists:reverse(Acc) ++ [{TS, Value} | Ps], 0};
         TS > TS1 ->
             {lists:reverse(Acc) ++ [{TS, Value} | Pss], 1};
         true ->
             cache_sorted(Value, TS, Ps, [P | Acc])
      end.
  