Spring如何为Android缓存REST响应 [英] How to cache REST responses, Spring For Android

查看:94
本文介绍了Spring如何为Android缓存REST响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标是缓存来自Web服务的一些响应.

The goal is to cache some responses from web service.

我正在使用Spring for Android框架- http://www.springsource.org/spring- android#documentation 与宁静的服务进行通信.据我所知,我可以使用通用Spring框架中的某些模块(

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?

*我在普通的Spring中没有任何经验.

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

推荐答案

因此,使用额外的数据库进行缓存更加容易.我已经使用了这些列: 到期日期,请求url,请求对象(哈希),响应对象(序列化).

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.

这篇关于Spring如何为Android缓存REST响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆