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%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-spec start (pid()) -> 'ok'.
start (TimedCachesManagerPid) ->
case shr_database:fetch(char_roster_db, <<"0">>, admin) of
{ok, _} -> ok;
not_found ->
shr_database:insert_at
(
char_roster_db,
<<"0">>,
any,
any,
chr_shim:generate_random_character_roster()
)
end,
shr_timed_caches_manager:new_cache
(
TimedCachesManagerPid,
char_roster_db,
none
),
ok.
|