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

Clearing cache for particular url without loading the image #1117

Closed
vijaykd opened this issue Apr 7, 2016 · 4 comments
Closed

Clearing cache for particular url without loading the image #1117

vijaykd opened this issue Apr 7, 2016 · 4 comments
Labels

Comments

@vijaykd
Copy link

vijaykd commented Apr 7, 2016

Is it possible to clear cache of particular image with out loading the image to imageView. I know we can clear image like this:

Glide.with(context.getApplicationContext())
                    .load(imageurl)
                    .signature(new StringSignature(String.valueOf(System.currentTimeMillis())))
                    .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                    .placeholder(R.drawable.placeholder)
                    .into(imageItem);

but I would like to know is it possible to clear particular image url cache without loading the image to imageView object if so how do I do it?

@TWiStErRob
Copy link
Collaborator

You cannot remove individual images from the cache, even the code you quoted doesn't remove the old versions of imageurl from the cache directly: they stay in cache until the disk cache reaches the limit and LRU notices that it's the oldest so an eviction is in order.

Actually looking more into the above code it looks like that always downloads a new version AND saves the data into local cache, but that file will never be re-used because the signature always changes: .load(imageurl).diskCacheStrategy(NONE) would have the same result without wasting the user's precious disk space.

@rizwan004
Copy link

rizwan004 commented Oct 24, 2017

I am using 4.2.0 version of glide library but StringSignature class is missing from it. How can I avoid caching for a perticular URI from internal stoarge in this case.

1 similar comment
@HaoXiaoyong
Copy link

I am using 4.2.0 version of glide library but StringSignature class is missing from it. How can I avoid caching for a perticular URI from internal stoarge in this case.

@sjudd
Copy link
Collaborator

sjudd commented Apr 18, 2018

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

No branches or pull requests

5 participants