anchor.diff:  %%% @end
   %%%-----------------------------------------------------------------------------
   
  +%% TODO: should match topic tree
   -module(emqttd_retained).
   
   -author("Feng Lee <feng@emqtt.io>").
  
positive.code: init([]) ->
      StatsFun = emqttd_stats:statsfun('retained/count', 'retained/max'),
      %% One second
      {ok, StatsTimer}  = timer:send_interval(1000, stats),
      %% Five minutes
      {ok, ExpireTimer} = timer:send_interval(300 * 1000, expire),
      {ok, #state{stats_fun     = StatsFun,
                  expired_after = env(expired_after),
                  stats_timer   = StatsTimer,
  
negative.code: 
  handle_info(stats, State = #state{stats_fun = StatsFun}) ->
      StatsFun(mnesia:table_info(retained, size)),
      {noreply, State, hibernate};
  
  handle_info(expire, State = #state{expired_after = Never})
      when Never =:= 0 orelse Never =:= undefined ->
      {noreply, State, hibernate};
  
  handle_info(expire, State = #state{expired_after = ExpiredAfter}) ->
  