anchor.diff:              ?MODULE, handle_db_event, nil, [{dbname, AuthDbName}]
           ),
       {noreply, State#state{event_listener=NewListener}};
  +handle_info({'DOWN', Ref, _, _, shutdown}, State) ->
  +    {stop, shutdown, State};
   handle_info({'DOWN', Ref, _, _, _Reason}, #state{db_mon_ref = Ref} = State) ->
  -    {noreply, reinit_cache(State)}.
  +    {noreply, reinit_cache(State)};
  +handle_info({'DOWN', Ref, _, _, Reason}, #state{closed = Closed} = State) ->
  +    case lists:delete(Ref, Closed) of
  +        Closed ->
  +            {stop, Reason, State};
  +        NewClosed ->
  +            {noreply, reinit_cache(State#state{closed = NewClosed})}
  +    end.
  +
   
   terminate(_Reason, #state{event_listener = Listener}) ->
       couch_event:stop_listener(Listener),
  
positive.code:     State#state{cache_size = 0}.
  
  
  reinit_cache(State) ->
      NewState = clear_cache(State),
      AuthDbName = ?l2b(config:get("couch_httpd_auth", "authentication_db")),
      true = ets:insert(?STATE, {auth_db_name, AuthDbName}),
      AuthDb = open_auth_db(),
      true = ets:insert(?STATE, {auth_db, AuthDb}),
      NewState#state{db_mon_ref = erlang:monitor(process, AuthDb#db.main_pid)}.
  
  
  add_cache_entry(_, _, _, #state{max_cache_size = 0} = State) ->
  
negative.code:     cache_size = 0,
      db_notifier = nil,
      db_mon_ref = nil,
      closed = [],
      event_listener = nil
  }).
  
  