Thursday, 15 April 2010

android - Google Volley - when to use Cache.remove and Cache.invalidate -


I am integrating volley in a project and coming across the standard

[We have a cache Items are there but want to give the user still refresh] Scenario

Now Google Wallet offers two ways to clear an item from the cache:

  GetRequestQueue (). GetCache () .remove (key);   

and

  getRequestQueue (). GetCache () Invalid (Key, Full Expire);   

I looked at the code and was a little surprised, that with invalid sets fullExpire to the right does not behave properly Call remove .

What can explain the benefits of using the remove () on fullExpire ?

Extract means that you are removing the actual cached data.

Invalid means that you are just marking the data as invalid, then the Volley will check with the server whether the data is still valid or not. The complete ending determines that Volley has used the data before verifying it with the server.

More details in the source:

No comments:

Post a Comment