PokeAPI / pokekotlin

Kotlin (or Java, Scala, etc) client for PokeApi
Apache License 2.0
171 stars 43 forks source link

Auto-caching #69

Open Selim042 opened 4 years ago

Selim042 commented 4 years ago

Are there plans to add auto-caching to this wrapper? I am looking at using this and would like to cache the results, but preferably not have my own wrappers that cache the results. I'd look into doing this myself, but I am not familiar with Kotlin.

sargunv commented 4 years ago

This should be doable by adding a caching interceptor to the OkHttp client, like this: https://medium.com/@bapspatil/caching-with-retrofit-store-responses-offline-71439ed32fda

I'm not sure if I'll implement it, but I'd welcome a PR that adds this option.

patrickdronk commented 4 years ago

@Selim042 It does mean you need to rebuild your cache after every deploy. It would definitely be an improvement. But there is no way around it to sort your own persistent caching like redis/hazelcast