Retrofit Caching Example and Why it SUCKS

  Рет қаралды 16,678

CodingWithMitch

CodingWithMitch

Күн бұрын

Пікірлер: 59
@raghvendrasahu5596
@raghvendrasahu5596 3 жыл бұрын
cache not store using POST method. HTTP 504 Unsatisfiable Request (only-if-cached) error
@EklakDangaura
@EklakDangaura 5 жыл бұрын
Damn, this is fast. Just had a look at the repo this morning.. now the video. Thanks. :)
@codingwithmitch
@codingwithmitch 5 жыл бұрын
I didn't think I'd do it until tomorrow, but I got inspired.
@pradeepkumarreddykondreddy7048
@pradeepkumarreddykondreddy7048 4 жыл бұрын
when max-stale value set to less than 1 day, caching is not working. Any reason for that ?
@jegali
@jegali 4 жыл бұрын
Hi Mitch, I have to cache aurora forecast data from services.swpc.noaa.gov which is 2MB in size. I managed to download, parse and save the data as a String to the Room Database, but if I try to select the data from the database I am told the data is too big. Do you have any suggestions how to handle this?
@rudreshsp3236
@rudreshsp3236 3 жыл бұрын
how to cancel a retrofit request used in executor , plz share video
@ikhiloyaimokhai9974
@ikhiloyaimokhai9974 4 жыл бұрын
Really great tutorial and explanation. When Room is used for caching, how often would the data be refreshed from the network?
@syyamnoor9792
@syyamnoor9792 4 жыл бұрын
It doesn't suck, it's just the implementation that does. Why don't you use just hit one api to fetch all the data and store it in a list etc, and then cache it. For searching we can avoid using other api hits like photos/{id}, we can simply search from that cached list.
@codingwithmitch
@codingwithmitch 4 жыл бұрын
its shit. You should cache with room
@abuzarshaikh3596
@abuzarshaikh3596 5 жыл бұрын
Great tutorial! cache can be modified or edited?
@Hereisthething
@Hereisthething 5 жыл бұрын
thanks for the video mitch and to clarify the retrofit cache is just in-memory right? i.e. if you kill the app and restart the app when you are offline, there is no cached data
@codingwithmitch
@codingwithmitch 5 жыл бұрын
It's saved to a file. It persists if the app dies I believe.
@ayoubmazrou8800
@ayoubmazrou8800 4 жыл бұрын
I have a question , I don't know how to create a recyclerview of videos ? , I saw your implementation but it doesn't works in my own project
@salmanhameed9495
@salmanhameed9495 5 жыл бұрын
How to cache a post request using retrofit ?
@codingwithmitch
@codingwithmitch 5 жыл бұрын
You can't
@fazalcs4820
@fazalcs4820 4 жыл бұрын
Mitch can you make the tutorial on Store library for storing data
@zuhrulanam5971
@zuhrulanam5971 3 жыл бұрын
I cant force update new data, retrofit always caching I have tried with no cache and also force network. Thanks bro
@jawadahmed6190
@jawadahmed6190 5 жыл бұрын
Hi mitch how to use retrofit cache in this secenario? When we have internet save data in cache but dont use .But if we dont have internet we use cache .
@codingwithmitch
@codingwithmitch 5 жыл бұрын
That's what it does by default
@jawadahmed6190
@jawadahmed6190 5 жыл бұрын
@@codingwithmitch Oh thanks. I didn't know that.
@salmanhameed9495
@salmanhameed9495 5 жыл бұрын
you didn't make serviceGenerator class' constructor private so, how it could be singleton ?
@codingwithmitch
@codingwithmitch 5 жыл бұрын
You got me
@RB-xx3xf
@RB-xx3xf 5 жыл бұрын
Very good job ! Thanks for the video !
@Daaaaaaavid
@Daaaaaaavid 2 жыл бұрын
Few years after and I used it, didn't understand why it should be so bad, if you cache it a db you also cache the whole response? My app loads a list from a rest api using retrofit, the caching works wonderfully, don't see the problem.
@luiferadventures
@luiferadventures 5 жыл бұрын
and what about Glide?
@TBadalov
@TBadalov 8 ай бұрын
This doesn't make retrofit caching any less. What you were describing are two different layers of caching. One can still use room to cache complex data structures which are still eventually retrieved via API call. One doesn't contradict another
@barakerzeonlist4608
@barakerzeonlist4608 5 жыл бұрын
I love your tutorial I'm learning java now just soon I'll be developer
@sergeyyjyakunin1514
@sergeyyjyakunin1514 3 жыл бұрын
Did you become a developer?
@muraddadasov8595
@muraddadasov8595 5 жыл бұрын
teacher should i go for both mvp and mvvm or only one?
@codingwithmitch
@codingwithmitch 5 жыл бұрын
Use one architecture per application IMO. But that is just my opinion. More than one would get confusing I think
@muraddadasov8595
@muraddadasov8595 5 жыл бұрын
@@codingwithmitch thank you much
@JacobZinn-rs1we
@JacobZinn-rs1we 2 жыл бұрын
It's true... retrofit caching really does suck. I spent 4 hours on it and it never hit cache. I spent 1 hour on room and it works great!
@muraddadasov8595
@muraddadasov8595 5 жыл бұрын
we love you keep going.
@muraddadasov8595
@muraddadasov8595 5 жыл бұрын
please make more application with rxjava. we learned but don't know where to use
@codingwithmitch
@codingwithmitch 5 жыл бұрын
Makes sense. I will do some examples of where it's commonly used.
@muraddadasov8595
@muraddadasov8595 5 жыл бұрын
@@codingwithmitch thank you for your response
@codingwithmitch
@codingwithmitch 5 жыл бұрын
@@muraddadasov8595 maybe I'll do a video where I show you 5 of the most common ways to use it or something
@muraddadasov8595
@muraddadasov8595 5 жыл бұрын
@@codingwithmitch thank you lot
@codinginflow
@codinginflow 5 жыл бұрын
Wow I don't believe Square created this shit! I am disappointed and a little bit sad.
@eaglepaul
@eaglepaul 5 жыл бұрын
Thanks Mitch. Love u😍
@codingwithmitch
@codingwithmitch 5 жыл бұрын
😘
@jesselima_dev
@jesselima_dev 5 жыл бұрын
Great advanced tips!!!
@preenxus3425
@preenxus3425 5 жыл бұрын
You are dont use m-prefix?
@codingwithmitch
@codingwithmitch 5 жыл бұрын
I stopped doing that recently. Not for any particular reason.
@HabeshaDeveloper
@HabeshaDeveloper 5 жыл бұрын
please make firebase realtime database pagination
@rohitmandiwal8567
@rohitmandiwal8567 4 жыл бұрын
None of the solution worked for me.. but yours :)
@preenxus3425
@preenxus3425 5 жыл бұрын
This is the many helpful. Thanks a lot!
@ArjunSingh-qt5jn
@ArjunSingh-qt5jn 4 жыл бұрын
Thankx brother - Vancouver
@maherabuthraa8975
@maherabuthraa8975 4 жыл бұрын
You are right .. caching sucks .. mainly on server-side.. biggest pain is caching error . OMG
@muraddadasov8595
@muraddadasov8595 5 жыл бұрын
teacher. the thing that i didn't understand is maxStale. you assigned for 7 days. what happens after 7 days ?
@codingwithmitch
@codingwithmitch 5 жыл бұрын
Here you go my friend stackoverflow.com/questions/33818854/what-is-difference-between-max-age-and-max-stale-in-cache-control-mechanism
@highlightmatchoffootball4986
@highlightmatchoffootball4986 2 жыл бұрын
thank you so muchhh
@enricobrunodelzotto7486
@enricobrunodelzotto7486 5 жыл бұрын
Setting a cache on the network layer it's ok, but what you're doing here is kind of an hack. Override headers with interceptors could be ok for a *fast* demo, but, all that part of logic should be done by the server. The caching at app level should be done with the repository pattern, in the higher level! So i really really no encourage people to follow the hack approach!
@codingwithmitch
@codingwithmitch 5 жыл бұрын
I said not to do this... This is how you should cache github.com/mitchtabian/Local-db-Cache-Retrofit-REST-API-MVVM
@mohammedhamouda104
@mohammedhamouda104 4 жыл бұрын
love it
@chirantanchaudhury2809
@chirantanchaudhury2809 5 жыл бұрын
very useful video for developers
@muraddadasov8595
@muraddadasov8595 5 жыл бұрын
please teacher make video about PageKeyedDataSource
@codingwithmitch
@codingwithmitch 5 жыл бұрын
Dunno what that is
@muraddadasov8595
@muraddadasov8595 5 жыл бұрын
@@codingwithmitch it is used with pageadapter
Kotlin Coroutines Beginner Example (Android)
23:12
CodingWithMitch
Рет қаралды 160 М.
Redis Crash Course
27:31
Web Dev Simplified
Рет қаралды 663 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
Single Source of Truth Principal in Software Development
6:30
CodingWithMitch
Рет қаралды 9 М.
Kotlin Singleton Example with MVVM and Coroutines
36:24
CodingWithMitch
Рет қаралды 56 М.
Making Retrofit Work For You by Jake Wharton
57:55
GDG Cincinnati
Рет қаралды 26 М.
Full guide to LRU In-Memory Caching in Android
17:36
Land of coding
Рет қаралды 727
LiveData with Coroutines and Flow (Android Dev Summit '19)
18:44
Android Developers
Рет қаралды 111 М.
RecyclerView | Everything You Need to Know
25:07
Practical Coding
Рет қаралды 150 М.
Model View View-Model (MVVM): Getting Started
29:12
CodingWithMitch
Рет қаралды 399 М.
Planning a Network Caching Strategy (VLOG)
13:48
CodingWithMitch
Рет қаралды 11 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН