dave08
10/30/2024, 11:50 AMclass FooRepo(
val db: ...,
val cache: ...,
val searchEngine: ...
) {
suspend fun createFoo(...) {
// create in db
// call corresponding invalideXXX for cache
// call addFoo(....) in searchEngine
}
}
2) Use an interface for FooRepo and delegation for all the unimplemented funs in the repo and then use decorators for each operation (con: very unclear what is going on by looking at the call site, might forget to do this when needed... to know whether it was done is going to another class and making sure this class is wrapped)
3) other ideas?CLOVIS
10/31/2024, 8:46 AMdave08
10/31/2024, 8:47 AMdave08
10/31/2024, 8:50 AMdave08
10/31/2024, 8:51 AMdave08
10/31/2024, 8:52 AMdave08
10/31/2024, 8:54 AMCLOVIS
10/31/2024, 9:07 AMcache { … }
without adding any layers: that's already a no-op!dave08
10/31/2024, 9:09 AMdave08
10/31/2024, 9:10 AM