anchor.diff:      Next = ets:next(CacheDb, Key),
       M1 =
   	case ets:lookup(CacheDb, Key) of
  -	    [{_,RR}] when RR#dns_rr.cnt =< TM ->
  +	    [{_,_,Cnt}] when Cnt =< TM ->
   		ets:delete(CacheDb, Key),
   		M + 1;
   	    _ ->
  
positive.code:     call({add_rr, #dns_rr { domain = Domain, class = Class,
  		       type = Type, ttl = TTL, data = Data}}).
  
  del_rr(Domain, Class, Type, Data) ->
      call({del_rr, #dns_rr { domain = Domain, class = Class,
  		       type = Type, cnt = '_', tm = '_', ttl = '_',
  		       bm = '_', func = '_', data = Data}}).
  
  res_cache_answer(Rec) ->
      lists:foreach( fun(RR) -> add_rr(RR) end, Rec#dns_rec.anlist).
  
negative.code: %% Add a resource record to the cache if there are space left.
  %% If the cache is full this function first deletes old entries,
  %% i.e. entries with oldest latest access time.
  do_add_rr(RR, Db, State) ->
      CacheDb = State#state.cache,
      TM = times(),
      case alloc_entry(Db, CacheDb, TM) of
  	true ->
  	    cache_rr(CacheDb, RR#dns_rr{tm = TM, cnt = TM}, TM);
  	_ ->
  	    false
      end.
  
  cache_rr(Cache, RR, Count) ->
      ets:insert(Cache, {cache_key(RR), RR, Count}).
  
  times() ->
      erlang:monotonic_time(second).
  