anchor.diff:      NewState = cache_point(Value, TS, State),
   
       % TODO: more dynamic flush interval
  -    if length(NewState#state.cache) > ?MIN_CACHE_ENTRIES ->
  +    if NewState#state.cache_size > ?MIN_CACHE_ENTRIES ->
              gen_server:cast(self(), flush_cache);
          true -> ok
       end,
  
positive.code:     case State#state.metadata of
          #whisper_metadata{archives=[A | _]} ->
              AlignedTS = TS - (TS rem A#whisper_archive.seconds),
              Cache = cache_sorted(Value, AlignedTS, State#state.cache),
              State#state{cache=Cache};
          _Otherwise ->
              State
      end.
  
  
  cache_sorted(Value, TS, []) ->
      [{TS, Value}];
  cache_sorted(Value, TS, Cache) ->
      cache_sorted(Value, TS, Cache, []).
  
  cache_sorted(Value, TS, [], Acc) ->
      lists:reverse(Acc) ++ [{TS, Value}];
  cache_sorted(Value, TS, [{TS1, _}=P | Ps]=Pss, Acc) ->
      if TS == TS1 ->
             lists:reverse(Acc) ++ [{TS, Value} | Ps];
         TS > TS1 ->
             lists:reverse(Acc) ++ [{TS, Value} | Pss];
         true ->
             cache_sorted(Value, TS, Ps, [P | Acc])
      end.
  
negative.code:         [] -> {noreply, State};
          Cs ->
              lager:debug("flushing metric cache of ~p (~w entries)",
                          [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">>, State#state.cache_size),
                      {noreply, State#state{cache=[], cache_size=0}};
                  _Error ->
                      % archive is not existing (yet)
                      % so dispatch a creation via rate-limiter
  