anchor.diff:  %% in the cache.
   do_refresh_cache(CacheDb) ->
       Now = times(),
  -    do_refresh_cache(ets:first(CacheDb), CacheDb, Now, Now).
  +    true = ets:safe_fixtable(CacheDb, true),
  +    Res = do_refresh_cache(ets:first(CacheDb), CacheDb, Now, Now),
  +    true = ets:safe_fixtable(CacheDb, false),
  +    Res.
   
   do_refresh_cache('$end_of_table', _, _, OldestT) ->
       OldestT;
  
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: match_rr({_, _, _} = Key) ->
      Time = times(),
      case ets:lookup(inet_cache, Key) of
  	[{_,RR,_}] when RR#dns_rr.ttl =:= 0 ->
  	    %% ttl=0 is served once (by the current process) as we request
  	    %% a deletion immediately. It is served at least once concurrently.
  	    %% Deletions are safe thanks to the use of safe_fixtable.
  	    ets:delete(inet_cache, Key),
  	    [RR];
  	[{_,RR,_}] when RR#dns_rr.tm + RR#dns_rr.ttl < Time ->
  	    ets:delete(inet_cache, Key),
  	    [];
  	[{_,RR,_}] ->
  	    %% Update the entry concurrently. If the server deletes it, we ignore
  	    %% the result. If the server updates it, we will race on the time part
  	    %% which should be close enough to each other (as we are racing).
  	    _ = ets:update_element(inet_cache, Key, {3, Time}),
  	    [RR];
  	[] ->
  	    []
  