anchor.diff:  -export([listen_for_changes/1, changes_callback/2]).
   
   -include_lib("couch/include/couch_db.hrl").
  +-include_lib("couch/include/couch_js_functions.hrl").
   
   -define(CACHE, chttpd_auth_cache_lru).
   
  
positive.code:     erlang:send_after(5000, self(), {start_listener, Seq}),
      {noreply, State#state{last_seq=Seq}};
  handle_info({start_listener, Seq}, State) ->
      {noreply, State#state{changes_pid = spawn_changes(Seq)}};
  handle_info(_Msg, State) ->
      {noreply, State}.
  
negative.code: changes_callback({stop, EndSeq, _Pending}, _) ->
      exit({seq, EndSeq});
  changes_callback({change, {Change}}, _) ->
      case couch_util:get_value(id, Change) of
          <<"_design/", _/binary>> ->
              ok;
          DocId ->
              UserName = username(DocId),
              couch_log:debug("Invalidating cached credentials for ~s", [UserName]),
              ets_lru:remove(?CACHE, UserName)
      end,
      {ok, couch_util:get_value(seq, Change)};
  changes_callback(timeout, EndSeq) ->
      exit({seq, EndSeq});
  