Skip to content

kevinsawicki/etag-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

etag-cache Build Status

Library to make transparent HTTP requests that can be served locally when the server replies with a 304 Not Modified response for a If-None-Match header set by the client.

The library is available from Maven Central:

<dependency>
  <groupId>com.github.kevinsawicki</groupId>
  <artifactId>etag-cache</artifactId>
  <version>0.6</version>
</dependency>

License

Examples

Making a request using a 10 MB cache

File file = new File("/tmp/http-cache");
EtagCache cache = EtagCache.create(file, TEN_MB);
CacheRequest request = CacheRequest.get("http://google.com", cache);
System.out.println("Response was " + request.body());
if (request.cached())
  System.out.println("Cache hit");
else
  System.out.println("Cache miss");

Dependencies

About

HTTP requests backed by an ETag cache

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages