tseisel
12/24/2019, 9:19 AMService
and a Worker
. For that matter I introduced a Repository
. Because the service needs to know when data from the repository have changed, the repository exposes data as Flow<List<Foo>>
(making it a reactive repository).
Since database access can be expensive i'd like to introduce some memory cache so that either the Service
or the Worker
can query the current List<Foo>
faster.
Where would you put that cache ?
1. As a field in the repository itself.
2. As a field in a decorator that wraps the Repository
.
3. In the Service
, by consuming the flow with broadcastIn
.
4. You wouldn't use a memory cache, as Room
loads fast enough.stojan
12/24/2019, 11:39 AMBen Abramovitch
12/24/2019, 5:00 PMRicardo901130
12/26/2019, 8:25 PM