stephanenicolas / robospice

Repo of the Open Source Android library : RoboSpice. RoboSpice is a modular android library that makes writing asynchronous long running tasks easy. It is specialized in network requests, supports caching and offers REST requests out-of-the box using extension modules.
Apache License 2.0
2.95k stars 545 forks source link

how not to cache #377

Closed mariuspena closed 9 years ago

mariuspena commented 9 years ago

Hi

robospice spring android setup. I am trying to get some songs from a rest service, same url different parameter "page" each time.

I use this: spiceManager.execute(request, request.createCacheKey(), DurationInMillis.ALWAYS_EXPIRED, new RequestListener<Songs>() {... where Songs is a class that Jackson uses to deserialize data in. request is a SpringAndroidSpiceRequest request.createCacheKey() always returns a different string (I use a Random to make sure)

yet the response for page=1 and page=2 are the same (no its not a server issue, tried it in an online rest tool and it works fine)

can someone help me please?

stephanenicolas commented 9 years ago

Use the overload of execute that doesn't accept a cachekey, nothing will be cached then.

It's not normal at all that you get the same result in cache with different cache keys. There is something wrong in your code. RS doesn't rely at all on URLs, no matter how close they are, to identify request results.

S.

2014-11-12 18:10 GMT-05:00 ceetah notifications@github.com:

Hi

robospice spring android setup. I am trying to get some songs from a rest service, same url different parameter "page" each time.

I use this: spiceManager.execute(request, request.createCacheKey(), DurationInMillis.ALWAYS_EXPIRED, new RequestListener() {... where Songs is a class that Jackson uses to deserialize data in. request is a SpringAndroidSpiceRequest request.createCacheKey() always returns a different string (I use a Random to make sure)

yet the response for page=1 and page=2 are the same (no its not a server issue, tried it in an online rest tool and it works fine)

can someone help me please?

— Reply to this email directly or view it on GitHub https://github.com/stephanenicolas/robospice/issues/377.