package Ġcom . e gor iku . rad iot ok . domain . use case Ċ Ċ import Ġcom . e gor iku . rad iot ok . common . ext . log D Ċ import Ġcom . e gor iku . rad iot ok . data . mapper . Network Station To Db Mapper Ċ import Ġcom . e gor iku . rad iot ok . db . Radio Tok Db Ċ import Ġcom . e gor iku . rad iot ok . domain . repository . IR ad io Fetch Network Repository Ċ Ċ class ĠRadio Cache UseCase ( ĊĠĠĠ Ġprivate Ġval Ġradio Tok Db : ĠRadio Tok Db , ĊĠĠĠ Ġprivate Ġval Ġradio Fetch Network Repository : ĠI Radio Fetch Network Repository Ċ ) Ġ: ĠI Radio Cache UseCase Ġ{ ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġpre Cache St ations () Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( radio Tok Db . station Dao (). get St ations Count () Ġ== Ġ 0 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlog D (" pre Cache St ations () ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġload And Cache () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġsuspend Ġfun Ġload And Cache () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstations Ġ= Ġradio Fetch Network Repository ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. load () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. map ( transform Ġ= ĠNetwork Station To Db Mapper ()) ĊĊĠĠĠĠĠĠĠ Ġradio Tok Db . station Dao (). insert All ( stations ) ĊĠĠĠ Ġ} Ċ } Ċ Ċ interface ĠI Radio Cache UseCase Ġ{ ĊĊĠĠĠ Ġsuspend Ġfun Ġpre Cache St ations () Ċ }