I am developing an android app using the Jetpack Compose with Coil ImageLoader library.
It shows a user's profile image.
I receive the profile data from the API. GET: /users/{userId}
The response contains userId
and profileImgKey
.
For the user profile image, Backend provides GET: /photo/{userId}
API.
But the problem is that if some user update his/her profile image, other users still see the previous profile image not the new image.
Because it is cached by Coil.
If I turn-off the caching option, it may work fine. But I don't want to do it. I don't want to lose the performance benefit.
When the user update their profile image, the profileImgKey
is changed.
So I want to use this as a cache key.
But I don't know how to use this.