xebia-functional / appsly-android-rest

An Android client library for RESTful based web services.
209 stars 51 forks source link

Binary combination of CachePolicies #38

Closed johnjohndoe closed 10 years ago

johnjohndoe commented 10 years ago

Can you tell if it makes sense or whether you plan to implement that CachePolicy settings can be combined. Here is an example, I think of:

@GET("/weather")
@Cached(policy = CachePolicy.LOAD_ON_ERROR | CachePolicy.LOAD_IF_OFFLINE, timeToLive = 10 * 60 * 1000)
void getForecast(@QueryParam("lat") double latitude, 
                            @QueryParam("lon") double longitude, 
                            Callback<ForecastResponse> callback);
raulraja commented 10 years ago

@johnjohndoe We thought about doing that but decided not to because some Cache policies can't compose. e.g. Load If Offline Vs Network Reload ... What we would like to do in the future is to allow a CacheResolutionPolicyClass or some kind of override that allows the user to define its own policicy resolvers through annotations and hook into the cache aware async http client