Skip to content

Reuse response body on Etag, Last-Modified, Expires and Cache-Control max-age

Notifications You must be signed in to change notification settings

satoshun/go-http-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP Cache for Go

GoDoc Build Status codecov

Reuse response body on Etag, Last-Modified, Expires and Cache-Control.

Usage

client := &http.Client{}
c := cache.NewMemoryCacheClient(client)
r, _ := http.NewRequest("GET", <url>, nil)
res, err := c.DoWithCache(r)

more detail example.

bonus

cachestat: check used cache or nor

## install
go get github.com/satoshun/go-http-cache/cmd/cachestat

## execute
cachestat https://www.google.co.jp/images/nav_logo242.png https://www.google.com/textinputassistant/tia.png

Not Modified - https://www.google.co.jp/images/nav_logo242.png
Use Cache - https://www.google.com/textinputassistant/tia.png

implements on memcached

memcached sample.

About

Reuse response body on Etag, Last-Modified, Expires and Cache-Control max-age

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages