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%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
start (_YawsParams) ->
   {ok, Pid} = sh_timed_caches_manager:start(),
   case sh_database:fetch(battle_db, <<"0">>) of
      {ok, _} -> ok;
      not_found ->
         sh_database:insert
         (
            battle_db,
            <<"0">>,
            any,
            bm_shim:generate_random_battle()
         )
   end,
   sh_timed_caches_manager:new_cache(Pid, battle_db, none),
   ok.