iagocanalejas / retrocache

This library provides an easy way for configure retrofit for use a 2 layer cache (RAM and Disk)
Apache License 2.0
35 stars 7 forks source link

Provide sample #6

Closed pedronveloso closed 7 years ago

pedronveloso commented 7 years ago

I've setup my project as described, but when switching the device to offline I've got the usual:

HTTP FAILED: java.net.UnknownHostException: Unable to resolve host

I've also taken a look at the app's internal directory, and the /cache directory didn't contain anything, suggesting that it failed to persist any changes.

This is the cache I've used: RetroCache.getDualCache, and I've tried the other as well. The cache is added to my retrofit builder, and I did replace my Interface methods with CachedCall as well. Not sure what I'm missing here.

iagocanalejas commented 7 years ago

Remember only @GET requests are cached (have an issue like this today). With given description i can't figure what's happening, a code sample, a failing demo or the complete stack trace could be nice for dig in this error.

iagocanalejas commented 7 years ago

@pedronveloso something new about the error?

pedronveloso commented 7 years ago

@iagocanalejas Thank you for the prompt reply. I didn't account for the fact that it was only available for GET requests, my issue was present in a POST one. I eventually did something on my own as most requests I needed caching where POST ones.

iagocanalejas commented 7 years ago

@pedronveloso ok, sorry for that, i plan to add support for other requests as i show in #7 but i don't know when i will have time to implement that.

pedronveloso commented 7 years ago

@iagocanalejas no need to be sorry you already did an excellent work by open-sourcing this one. It is a great idea to combine caching with the request, keep at it 👍