Licence: Apache 2.0
How to use:
@Override
public void run(final MainConfiguration configuration, final Environment environment) {
environment.jersey().register(
new CachingFilterFeature(
Arrays.asList("Accept"), // list of HTTP request headers to use for key in addition to the method (e.g. GET) and URL
CacheBuilder.newBuilder().softValues().build()
));
...
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/cached")
@ResponseCachedByFilter(10000)
public Object getCached() {
return dao.get();
}
Parameter -- TTL of the cache entry in milliseconds.