Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear glide cache across all activites?

I have the user's profile pic across multiple activities in my app. Once, they change their profile image, I want to make sure that all my Glide instance's cache are cleared. That way when they navigate around the app, they can see their updated profile pic.

Currently I'm using this method: Glide.get(activity).clearDiskCache(); and that only clears the Glide cache for that activity and not across my app.

Hope someone has a quick solution, where I don't need to call the .signature() function for each glide instance in each of my activites. Or clear each glide cache in each activity.

like image 436
TheQ Avatar asked Sep 06 '25 02:09

TheQ


1 Answers

Try

Glide.get(context).clearMemory();

OR

Glide.get(context).clearDiskCache();

Note: clearMemory() must be called on the main thread. clearDiskCache() must be called on a background thread. You can't call both at once on the same thread.

like image 161
PEHLAJ Avatar answered Sep 09 '25 22:09

PEHLAJ