anchor.diff:      {MegaSecs, Secs, _MicroSecs} = os:timestamp(),
       MegaSecs*1000000 + Secs.
   
  +%% @doc Expires old content
  +-spec cache_flush() -> ok.
  +cache_flush() ->
  +    Now = now_secs(),
  +    Selector = ets:fun2ms(fun({K, Expiry, _Res}) 
  +            when Expiry < Now -> true end),
  +    ets:select_delete(simple_cache, Selector),
  +    ok.
  +
   %% @doc For a key K, caches the output of F(K).
   -spec cached_fun(function(), list()) -> {_, 'expire' | 'hit' | 'miss'}.
   cached_fun(F, K) ->
       Now = now_secs(),
       case ets:lookup(simple_cache, K) of
       [] ->  %Not present in cache
  +        cache_flush(), %Flushing on add ensures size is managed
           FuncRes = F(K),
           ets:insert(simple_cache, {K, Now+?LIFETIME, FuncRes}),
           {FuncRes, miss};
  
positive.code: 
  cached_fun_miss_test() ->
      F = fun(K) -> K ++ "demo" end, %A mock function
      ?assertEqual(cached_fun(F, "127"), {"127demo", miss}).
  cached_fun_insert_test() ->
      F = fun(K) -> K ++ "demo" end, %A mock function
      ?assertEqual(cached_fun(F, "127"), {"127demo", hit}).
  
negative.code:     F = fun(K) -> K ++ "demo" end, %A mock function
      timer:sleep((?LIFETIME+1)*1000),
      ?assertEqual(cached_fun(F, "127"), {"127demo", expire}).
  cache_cleanup_test() ->
      F = fun(K) -> K ++ "demo" end, %A mock function
      ?assertEqual(cached_fun(F, "cleanme2"), {"cleanme2demo", miss}),
      %The above insetion of a new value, afer the LIFETIME sleep ealier,
      %should have cleaned up the earlier value below.
      ?assertEqual(cached_fun(F, "cleanme"), {"cleanmedemo", miss}).
  
  delete_table_test() ->
      delete_table().
  