Caching mechanism in Glide library | Android
Henil Chhipani
Working @playpowerlabs | Software Engineer | Passionate about coding & Product building | Kotlin | Android | Jetpack Compose | React native
Glide is one the best library tool to load network image on your app. Recently i am researching on how glide is working. They implement 4 level catching mechanism to load image quickly in your app
To make this process faster it uses a caching mechanism that checks for images in 4 levels in the app:
1 Active resources: means any of the views has loaded image previously
2 Memory cache: if the image recently loaded and still available in memory
3 Resources: has this image been decoded, transformed, and written to the disk cache before.
4 Data: if these data in which image obtained from written into the disk before The first two steps check to see if the resource is in memory and if so, return the image immediately.
The second two steps check to see if the image is on disk and return quickly, but asynchronously. If all four steps fail to find the image, then Glide will go back to the original source to retrieve the data. we can also configure the cache memory size used by Glide.
Sometimes it's fascinating how engineering is done. It feels just like magic. But if you look inside it's pure logic to avoid all edge cases and do tasks as fast as possible so it feels like magic.
Student at SHANTILAL SHAH ENGINEERING COLLEGE ,BHAVNAGAR 043
7 个月Keep it up bro ??