asarazan / bismarck

Caching for Kotlin Multiplatform
Apache License 2.0
4 stars 1 forks source link

Dedupe is now the default. Should it be optional? #7

Open asarazan opened 4 years ago

asarazan commented 4 years ago

I didn't like the class hierarchy that we had, so I switched it to dedupe outgoing calls by default. I don't see a lot of utility in the dumb approach but I'm open to arguments

treelzebub commented 4 years ago

does job?.join() dedupe by equals(), hashCode(), or some other mechanism? aka, can I define what a duplicate means by modifying my data model?

asarazan commented 4 years ago

Generally this happens at a different layer than the job or coroutine system. Basically it just means if there's already an in-flight request happening, and there hasn't been an invalidate call since the request started, it will not initiate a new request, and will instead piggyback the existing one.

treelzebub commented 4 years ago

i can think of folks who might prefer a new request to replace the duplicate instead. i'm not necessarily advocating for DedupingBismarck to come back, but i'm not yet convinced this is an opinion our default should hold.

asarazan commented 4 years ago

I mean what does freshness mean if you're not going to trust it? If you turn off the freshness strategy then you can be guaranteed a new network call for every fetch invoked.