You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been sitting on this for a while as a future feature but hadn't documented it.
The API would allow specifying a cache interaction policy both "downward" on the load and "upward" back through the processing. Through this you can facilitate complex cache interactions for both valid and seemingly-questionable use cases.
Random subset of interactions from other issues:
Skip memory cache "downward" only.
Skip memory cache "upward" only.
Load from local cache (memory or disk) only.
Force re-load from network.
I'm not going to do a full-on API strawman, but I know we'll probably want some EnumSet action with
Hi:
Support for force reloading,now? Thank you..
I think your code is very amazing,but sometiomes I want to clear the cache (memory and disk), reload from cloud.Could you tell me a way to do that?
In the mean time the following line of code will force download from network:
//force no proxy cache by appending a random number to the image url
String imageurl = person.getImageUrl() + "?t=" + System.currentTimeMillis();
That works, but then it caches it that that throwaway url as the key, so it'll reload for each individual one. We absolutely need to be able to invalidate any cache on demand. Is there an updated timeline on this?
That works, but then it caches it that that throwaway url as the key, so
it'll reload for each individual one. We absolutely need to be able to
invalidate any cache on demand. Is there an updated timeline on this?
—
Reply to this email directly or view it on GitHub #438 (comment).
Sorry if this question is silly.
I am loading images from disk. When I remove the file from gallery the image still loads. What should I do to invalidate this image or clean this specific image from cache? I don't understand how to do it using MemoryPolicy or NetworkPolicy.
note: mPicassoTg is a field of my main activity, so I hope it's not garbage collected.
behavior:
mPicassoTg.onBitmapLoaded is NOT CALLED. (nor is onBitmapFailed)
mPicassoTg.onPrepareLoad is called
Everything works fine if I remove networkPolicy setter,
It works also on a new image, that is not in the cache (network is working and url is correct).
I want to use disk cache, but not cache any images in memory (in order to keep memory consumption low), but as it looks
.memoryPolicy(MemoryPolicy.NO_STORE)
implicitly applies NetworkPolicy.NO_STORE as well. Is this a bug or can I get around this? Does my approach of reducing memory consumption make sense at all?
I want to use disk cache, but not cache any images in memory (in order to
keep memory consumption low), but as it looks
.memoryPolicy(MemoryPolicy.NO_STORE)
implicitly applies NetworkPolicy.NO_STORE as well. Is this a bug or can I
get around this? Does my approach of reducing memory consumption make sense
at all?
—
Reply to this email directly or view it on GitHub #438 (comment).
I'm not worried about calling this on every call, I want to use disk cache, but not memory cache. Is that possible and does that make sense at all? (I am handling many large images, which are not accessed often, so I want to cache them on disk, but not in memory. GC is slow sometimes and my app crashes due to high memory consumption, even though I have removed all my references already. So I wanted to have the least load on memory possible.)
I'm not worried about calling this on every call, I want to use disk
cache, but not memory cache. Is that possible and does that make sense at
all? (I am handling many large images, which are not accessed often, so I
want to cache them on disk, but not in memory. GC is slow sometimes and my
app crashes due to high memory consumption, even though I have removed all
my references already. So I wanted to have the least load on memory
possible.)
—
Reply to this email directly or view it on GitHub #438 (comment).
Also invalidate is not working for me some reason. I am calling it like this (called from an activity):
Picasso.with(this).invalidate(image_url);
I want to load the new image when the user uploads a new one, but it is not working for some reason... I would appreciate any comments on that as well.
I have the same problem with @mrafieej . When I use invalidate after the basic method of loading an image, somewhere during the application, the images don't show anything (since there is no error image, which is fine to me),
I am trying any codes posted here but no luck. A detail of the problem is this: when the user changes the image from another device or platform (Web browser, or in an IOS device), it doesn't update the image in the android app. Can you help me? Thanks!
How would we use this to cache images only for the lifetime of a component (Fragment, ViewGroup, ...)?
Use case: We have a fragment with a grid of images which should be cached for the lifetime of the fragment. When the user navigates away from and back to the fragment we want the images to reload.
Hi, I wanna cache images in memory by Picasso but I have a problem for reloading. Is it possible changing an image when its resource has changed in server. In other words, when network is off, used from cached image in memory and when network is On check the URL, If resource has changed then reload image. if not use a previous image.
Please let me know it is possible or not? And How can I do it?
I am also facing similar problem. I am using 2.5.2 version.
I have an image(profile_picture) at a url. Now i want that to be cached. But when I re-upload/change the image on the server with same link, i want picasso to update that image.
I tried using invalidate(url), memoryPolicy(NO_CACHE), networkPolicy(NO_CACHE) but nothing seems to work. need urgent solution
Activity
TequilaZhang commentedon Mar 31, 2014
Hi:
Support for force reloading,now? Thank you..
I think your code is very amazing,but sometiomes I want to clear the cache (memory and disk), reload from cloud.Could you tell me a way to do that?
JakeWharton commentedon Mar 31, 2014
Not yet. No.
On Sun, Mar 30, 2014 at 10:26 PM, TequilaZhang notifications@github.comwrote:
TequilaZhang commentedon Mar 31, 2014
Hi:
will you update it or not later?
ovy9086 commentedon Mar 31, 2014
is work on this started on a branch? or after 2.3 release?
JakeWharton commentedon Mar 31, 2014
Not yet started.
On Mon, Mar 31, 2014 at 3:28 PM, Ovidiu Latcu notifications@github.comwrote:
dnkoutso commentedon Mar 31, 2014
After 2.3.
Queatz commentedon May 22, 2014
We need this, buddy.
dnkoutso commentedon May 27, 2014
Moved to 2.4. This will be a good new feature for 2.4.
dnkoutso commentedon Jul 8, 2014
This will be scoped (and most likely implemented) for 2.4.
First thing is scroll listener based loading.
odedregev commentedon Jul 14, 2014
+1
In the mean time the following line of code will force download from network:
//force no proxy cache by appending a random number to the image url
String imageurl = person.getImageUrl() + "?t=" + System.currentTimeMillis();
jfyles commentedon Aug 1, 2014
That works, but then it caches it that that throwaway url as the key, so it'll reload for each individual one. We absolutely need to be able to invalidate any cache on demand. Is there an updated timeline on this?
JakeWharton commentedon Aug 1, 2014
No timeline.
On Aug 1, 2014 9:46 AM, "Justin Fyles" notifications@github.com wrote:
17 remaining items
jvcjunior commentedon Feb 12, 2015
Sorry if this question is silly.
I am loading images from disk. When I remove the file from gallery the image still loads. What should I do to invalidate this image or clean this specific image from cache? I don't understand how to do it using MemoryPolicy or NetworkPolicy.
dnkoutso commentedon Feb 12, 2015
Read MemoryPolicy and NetworkPolicy JavaDoc.
picasso.load(url).memoryPolicy(NO_CACHE).networkPolicy(NO_CACHE)to force the request to reload from the network.There is also
clearKeyUriinCacheyou can use to evict the image from the memory cache.Karlooie commentedon Mar 9, 2015
Hello,
I'm facing a problem with network policy.
my code to reload an image from network is:
note: mPicassoTg is a field of my main activity, so I hope it's not garbage collected.
behavior:
mPicassoTg.onBitmapLoaded is NOT CALLED. (nor is onBitmapFailed)
mPicassoTg.onPrepareLoad is called
Everything works fine if I remove networkPolicy setter,
It works also on a new image, that is not in the cache (network is working and url is correct).
Am I missing something?
need more details?
Thank you for the great Picasso and all the support,
Carlo
oliverhausler commentedon Apr 11, 2015
I want to use disk cache, but not cache any images in memory (in order to keep memory consumption low), but as it looks
.memoryPolicy(MemoryPolicy.NO_STORE)
implicitly applies NetworkPolicy.NO_STORE as well. Is this a bug or can I get around this? Does my approach of reducing memory consumption make sense at all?
JakeWharton commentedon Apr 11, 2015
Just set a Cache instance which does nothing. Then you don't have to worry
about including those options on every call.
On Sat, Apr 11, 2015, 2:43 PM oliverhausler notifications@github.com
wrote:
oliverhausler commentedon Apr 11, 2015
I'm not worried about calling this on every call, I want to use disk cache, but not memory cache. Is that possible and does that make sense at all? (I am handling many large images, which are not accessed often, so I want to cache them on disk, but not in memory. GC is slow sometimes and my app crashes due to high memory consumption, even though I have removed all my references already. So I wanted to have the least load on memory possible.)
[I'm also trying to work around #972]
JakeWharton commentedon Apr 11, 2015
Picasso only has a memory cache so making it no-op won't affect the disk
caching (which lives in the HTTP client).
I can look into the cache API behavior later.
On Sat, Apr 11, 2015, 2:53 PM oliverhausler notifications@github.com
wrote:
mrafieej commentedon Apr 24, 2015
@JakeWharton
I am having memory issues also. could you please elaborate on what the right way to set a Cache instance is? Thanks!
mrafieej commentedon Apr 24, 2015
Also invalidate is not working for me some reason. I am calling it like this (called from an activity):
Picasso.with(this).invalidate(image_url);
I want to load the new image when the user uploads a new one, but it is not working for some reason... I would appreciate any comments on that as well.
nitrodamsel commentedon May 3, 2015
I have the same problem with @mrafieej . When I use invalidate after the basic method of loading an image, somewhere during the application, the images don't show anything (since there is no error image, which is fine to me),
I am trying any codes posted here but no luck. A detail of the problem is this: when the user changes the image from another device or platform (Web browser, or in an IOS device), it doesn't update the image in the android app. Can you help me? Thanks!
danieljanes commentedon May 15, 2015
How would we use this to cache images only for the lifetime of a component (Fragment, ViewGroup, ...)?
Use case: We have a fragment with a grid of images which should be cached for the lifetime of the fragment. When the user navigates away from and back to the fragment we want the images to reload.
omid-nazifi commentedon Jun 19, 2015
Hi, I wanna cache images in memory by Picasso but I have a problem for reloading. Is it possible changing an image when its resource has changed in server. In other words, when network is off, used from cached image in memory and when network is On check the URL, If resource has changed then reload image. if not use a previous image.
Please let me know it is possible or not? And How can I do it?
Thanks
parthanjaria commentedon Jun 21, 2018
I am also facing similar problem. I am using 2.5.2 version.
I have an image(profile_picture) at a url. Now i want that to be cached. But when I re-upload/change the image on the server with same link, i want picasso to update that image.
I tried using invalidate(url), memoryPolicy(NO_CACHE), networkPolicy(NO_CACHE) but nothing seems to work. need urgent solution