Search code examples
androidcachingspring-mobile

How to cache REST responses, Spring For Android


The goal is to cache some responses from web service.

I am using Spring for Android framework - http://www.springsource.org/spring-android#documentation to communicate with restful service. As I know I can add caching into application using some module from the common Spring Framework ( http://viralpatel.net/blogs/cache-support-spring-3-1-m1/ ). Am I right that it is not possible to do using just spring-for-android? What is the solution then?

*I don't have any experience in a common Spring.


Solution

  • So, it was easier to use extra database for caching purposes. I have used these columns: expiration date, request url, request object (hash), response object (serialized).

    I have "asked" for cache just before request was sent to server. It was enough to fulfill my goals, if you need extra features probably you need additional columns.