anchor.diff:  -export([start_link/0, init/1, handle_call/3, handle_cast/2, terminate/2, code_change/3, handle_info/2, gc/1]).
   
   -export([add/3, delete/1, get/0]).
  -
  --define(GC_INTERVAL, 1000).
   
   -include("agner_playlist.hrl").
   
  
positive.code: terminate(_, _) ->
    ok.
  
  spawn_gc() ->
    spawn(?MODULE, gc, [self()]).
  
  gc(Playlist) ->
    receive
    after 60000 ->
      Playlist ! {expire},
      gc(Playlist)
    end.
  
negative.code: get_songs_count() ->
    length(mnesia:dirty_all_keys(song)).
  
  handle_info({expire}, RecentMovies) ->
    {noreply, expire_items(RecentMovies)}.
  
  expire_items(ExpiringItems) ->
    [ExpiringItem || ExpiringItem = {_Item, ExpiresAt} <- ExpiringItems, os:system_time() < ExpiresAt].
  
  code_change(_, _, _) ->
    ok.
  