Declarative Cache Control API #438
Comments
Hi: |
Not yet. No. On Sun, Mar 30, 2014 at 10:26 PM, TequilaZhang notifications@github.comwrote:
|
Hi: |
is work on this started on a branch? or after 2.3 release? |
Not yet started. On Mon, Mar 31, 2014 at 3:28 PM, Ovidiu Latcu notifications@github.comwrote:
|
After 2.3. |
We need this, buddy. |
Moved to 2.4. This will be a good new feature for 2.4. |
This will be scoped (and most likely implemented) for 2.4. First thing is scroll listener based loading. |
+1 In the mean time the following line of code will force download from network: |
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? |
No timeline.
|
How does Square manage profile photos then? Is there any mechanism for a user changing a profile image? We store ours on S3 with a hash of the user ID (hence the cache issues if the image is changed but the path isn't) - we could store it with an arbitrary guid, but we'd lose the simplicity of the implementation. Any input would be greatly appreciated! |
The workaround works and even can be extended... Save the url with the timestamp and whenever you want to invalidate a cached image, update the time of the url... PS: Here is another workaround (that can be extended, but works with simple urls for example): http://stackoverflow.com/questions/22243417/android-picasso-clear-cache/24001131#24001131 |
Allow caching forever and change the URL when the image changes. |
Concerning temporary workaround mentioned by MichaelFlisar. How can I save the url with the timestamp and then update that timestamp to invalidate a cached image file? I have tried linux touch command on image files from my local apache server public directory, manipulating both access and modification time with no success. Please help. |
The cache invalidation should take place on the client side and not on if the image url is: request: On Tue, Aug 5, 2014 at 11:14 PM, masermb notifications@github.com wrote:
Oded Regev The largest fan-generated media platform in global football. mobile first! |
Thank you odedregev! That's what I wanted! Adding time request value allows me to force Picasso to load image from network instead of cache. |
It would be awesome to see this: public enum BitmapSource { MEMORY, DISK, NETWORK } |
Hi, has this feature been implemented or do we still need to use the workaround suggested above (by MichaelFlisar)? Thanks. |
Current best candidate: picasso.load('http://example.com/')
.cachePolicy(NO_CACHE, NO_STORE)
.networkPolicy(NO_CACHE, NO_STORE, OFFLINE)
.into(imageView);
enum MemoryPolicy {
NO_CACHE, NO_STORE
}
enum NetworkPolicy {
NO_CACHE, NO_STORE, OFFLINE
} This will be what's implemented unless anyone has other thoughts. |
Awesome to see progress on this. What's the difference between NO_CACHE and NO_STORE? |
One is reading, the other is writing, respectively. On Thu, Dec 11, 2014, 6:52 PM rothschild86 notifications@github.com wrote:
|
ah. nice. |
Sorry if this question is silly. |
Read MemoryPolicy and NetworkPolicy JavaDoc.
There is also |
Hello, 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: Everything works fine if I remove networkPolicy setter,
Am I missing something? Thank you for the great Picasso and all the support, |
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? |
Just set a Cache instance which does nothing. Then you don't have to worry On Sat, Apr 11, 2015, 2:43 PM oliverhausler notifications@github.com
|
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] |
Picasso only has a memory cache so making it no-op won't affect the disk I can look into the cache API behavior later. On Sat, Apr 11, 2015, 2:53 PM oliverhausler notifications@github.com
|
@JakeWharton |
Also invalidate is not working for me some reason. I am calling it like this (called from an activity): |
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, ...)? |
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. Thanks |
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 |
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:
I'm not going to do a full-on API strawman, but I know we'll probably want some
EnumSet
action withThis API will trump the existing weak
skipCache()
method onRequestCreator
.The text was updated successfully, but these errors were encountered: