com.github.kevinsawicki:etag-cache

Library for caching HTTP responses using entity tags

License

License

GroupId

GroupId

com.github.kevinsawicki
ArtifactId

ArtifactId

etag-cache
Last Version

Last Version

0.6
Release Date

Release Date

Type

Type

jar
Description

Description

Library for caching HTTP responses using entity tags
Project URL

Project URL

https://github.com/kevinsawicki/etag-cache
Source Code Management

Source Code Management

https://github.com/kevinsawicki/etag-cache

Download etag-cache

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.kevinsawicki/etag-cache/ -->
<dependency>
    <groupId>com.github.kevinsawicki</groupId>
    <artifactId>etag-cache</artifactId>
    <version>0.6</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.kevinsawicki/etag-cache/
implementation 'com.github.kevinsawicki:etag-cache:0.6'
// https://jarcasting.com/artifacts/com.github.kevinsawicki/etag-cache/
implementation ("com.github.kevinsawicki:etag-cache:0.6")
'com.github.kevinsawicki:etag-cache:jar:0.6'
<dependency org="com.github.kevinsawicki" name="etag-cache" rev="0.6">
  <artifact name="etag-cache" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.kevinsawicki', module='etag-cache', version='0.6')
)
libraryDependencies += "com.github.kevinsawicki" % "etag-cache" % "0.6"
[com.github.kevinsawicki/etag-cache "0.6"]

Dependencies

compile (2)

Group / Artifact Type Version
com.github.kevinsawicki : http-request jar 5.4
com.jakewharton : disklrucache jar 2.0.2

test (2)

Group / Artifact Type Version
junit : junit jar 4.10
org.eclipse.jetty : jetty-server jar 8.0.3.v20111011

Project Modules

There are no modules declared in this project.

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

Versions

Version
0.6
0.5
0.4
0.3
0.2
0.1