Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to clean cached images #197

Open
rowinbot opened this issue Apr 28, 2018 · 14 comments
Open

No way to clean cached images #197

rowinbot opened this issue Apr 28, 2018 · 14 comments

Comments

@rowinbot
Copy link

Hi, I've seen a lot of issues around here about the cache, but I'm having issues with an app I'm developing, when you are able to log in, have a home screen with your avatar, but then when you change the avatar (it keeps the same url, only the image itself change) it doesn't reload because of the cache. I'm not able to provide inmutable url so currently don't know what to do, any help please?

It would be great if you provide a method to clean cached images so I can call it when the user logs out or re-run the app.

@DylanVann
Copy link
Owner

The main advantage of this package is that it does more aggressive caching.

If you want to clear the cache every time then you may as well just use Image. In your case I think it would be better to add a cache control property for that specific image.

@rowinbot
Copy link
Author

How do I so?

@DylanVann
Copy link
Owner

DylanVann commented Apr 30, 2018

A cache control property isn't currently a feature but I'm open to PRs. It would be better than clearing the whole cache each time.

As far as an immediate solution for you:

  • Use Image.
  • Use FastImage, but manually bust the cache yourself using a query parameter (uri: http://example.com/example.png?bust=123, where you change 123 each time you need to bust the cache).

I think either of those would be fine.

@n1ru4l
Copy link
Contributor

n1ru4l commented May 9, 2018

@DylanVann What about implementing a method for busting the whole cache (for development environments).

@FibreFoX
Copy link

http://bumptech.github.io/glide/doc/caching.html#clearing-memory

// This method must be called on the main thread.
Glide.get(context).clearMemory();

Maybe instead of using url-manipulations, there should be some API where the developers can trigger these cache-purges themselves 😃 of course with a lot of "you might not want to use this"-warnings around 😸
I'm actually fighting against some caching-issue where I want to use this library, but have no control over the HTTP headers the server is sending to me, therefor when having a cached image, and via a different workflow change that image (like profile-image upload in my app), the URL stays the same, so having a way to evict that image from cache, should be available (I think).

@DylanVann
Copy link
Owner

I'd be open to adding:

@guhungry
Copy link
Contributor

guhungry commented Mar 9, 2019

@DylanVann #425

@luatnd
Copy link

luatnd commented Jul 18, 2019

I'd be open to adding:

Thanks, it would be nice to see these features!
Is #425 of @guhungry good?

@lucasfeijo
Copy link

I'm having issues because fast-image cached invalid images during an s3 outage and now won't download the correct versions unless the url changes, which it won't because the url I use redirects to the real url, so I can't do the bust parameter approach. I would love a way to clear all cache.

@cuongnm2301
Copy link

I'd be open to adding:

Any update, i having problem with caches too

@akunal1
Copy link

akunal1 commented Feb 3, 2021

A cache control property isn't currently a feature but I'm open to PRs. It would be better than clearing the whole cache each time.

As far as an immediate solution for you:

  • Use Image.
  • Use FastImage, but manually bust the cache yourself using a query parameter (uri: http://example.com/example.png?bust=123, where you change 123 each time you need to bust the cache).

I think either of those would be fine.

if my query params changes will it bust the cache of that particular image automatically or we have to do manually ? if manually how to do that.

@thangpq
Copy link

thangpq commented Oct 24, 2022

Why no answer like that?

FastImage.clearDiskCache();
FastImage.clearMemoryCache();

@lorenjohnson
Copy link

I was here for a little while wondering how in the heck do I clear the cache during development. I initially thought @thangpq that your response was saying, that these methods SHOULD exist and it took me a minute to realize they do exist!

Long story short, after a careful read through IMHO this issue could be closed. Thanks for the library! Been super helpful in our app.

@nandha-kumar-hajari
Copy link

Why no answer like that?

FastImage.clearDiskCache(); FastImage.clearMemoryCache();

This actually worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests