Open klide10 opened 9 years ago
@klide10 There is an additional constructor in the callback where you can pass a CacheInfo object for that particular callback at the time you call the service.
CacheInfo cacheInfo = new CacheInfo(key, policy, timeToLive);
getStream(offset, orderby, token, new Callback(cacheInfo){
...
});
You can have on demand cache policies per request that override the default cache policies as expressed in the annotations. Hope it helps.
Hallo everyone! I've a problem with this fantastic project: i want to set the Cache value to set dynamically time of my service call. I found only the declaration of class and set "timeToLive" parameter in declaration (example below)
@RestService public interface NovitaAPI { @GET("/stream/last/{offset}/{orderby}") @Cached(policy = CachePolicy.ENABLED, timeToLive = 30 * 60 * 1000) //void getForecast(@QueryParam("user_email") String user_email, Callback callback);
/void getStream(@Header("Authorization") String token,
@Body BaseRequest requestBody,
Callback callback); /
void getStream(@Path("offset") String offset,@Path("orderby") String orderby,@Header("Authorization") String token,
Callback callback);
}
There's a way to do it? I want only set timeToLive before call getStream.
Thank in advance!