Ruzard
Ruzard

Reputation: 1359

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.

Upvotes: 6

Views: 1951

Answers (2)

Ruzard
Ruzard

Reputation: 1359

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.

Upvotes: 0

Snicolas
Snicolas

Reputation: 38168

I am a contributor to RoboSpice. This library offers a nice asynchronous model for network request with caching. We also have a Spring Android Module that you could be interested in.

Upvotes: 1

Related Questions