https://github.com/moul/hcfilters
filtering middlewares for https://github.com/gregjones/httpcache
https://github.com/moul/hcfilters
filter golang http-cache
Last synced: 9 months ago
JSON representation
filtering middlewares for https://github.com/gregjones/httpcache
- Host: GitHub
- URL: https://github.com/moul/hcfilters
- Owner: moul
- License: other
- Created: 2020-05-06T17:55:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-10T02:58:22.000Z (about 2 years ago)
- Last Synced: 2025-02-13T05:16:57.052Z (11 months ago)
- Topics: filter, golang, http-cache
- Language: Go
- Homepage: https://moul.io/hcfilters
- Size: 38.1 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE-APACHE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Authors: AUTHORS
Awesome Lists containing this project
README
# hcfilters
:smile: filters for [github.com/gregjones/httpcache](https://github.com/gregjones/httpcache)
[](https://circleci.com/gh/moul/hcfilters)
[](https://pkg.go.dev/moul.io/hcfilters)
[](https://github.com/moul/hcfilters/blob/master/COPYRIGHT)
[](https://github.com/moul/hcfilters/releases)
[](https://goreportcard.com/report/moul.io/hcfilters)
[](https://www.codefactor.io/repository/github/moul/hcfilters)
[](https://codecov.io/gh/moul/hcfilters)
[](https://golangci.com/r/github.com/moul/hcfilters)
[](https://sourcegraph.com/github.com/moul/hcfilters?badge)
[](https://manfred.life/)
## Usage
```console
$ go get -u moul.io/hcfilters
```
```golang
// before
client := &http.Client{
Transport: httpcache.NewTransport(
diskcache.New(diskcachePath),
),
}
// after
client := &http.Client{
Transport: httpcache.NewTransport(
hcfilters.MaxSize( // skip caching results > 2Mb
diskcache.New(diskcachePath),
2*1024*1024,
),
),
}
```
## License
© 2020 [Manfred Touron](https://manfred.life)
Licensed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0) ([`LICENSE-APACHE`](LICENSE-APACHE)) or the [MIT license](https://opensource.org/licenses/MIT) ([`LICENSE-MIT`](LICENSE-MIT)), at your option. See the [`COPYRIGHT`](COPYRIGHT) file for more details.
`SPDX-License-Identifier: (Apache-2.0 OR MIT)`