gregjones/httpcache
GitHub: gregjones/httpcache
为 Go 的 http.Client 提供符合 RFC 7234 标准的 HTTP 响应缓存 Transport 实现,支持多种存储后端。
Stars: 758 | Forks: 177
# httpcache
[](https://travis-ci.org/gregjones/httpcache) [](https://godoc.org/github.com/gregjones/httpcache)
httpcache 包提供了一个 http.RoundTripper 实现,它充当 http 响应的缓存,并且基本符合 [RFC 7234](https://tools.ietf.org/html/rfc7234) 标准。
它仅适合用作“私有”缓存(例如用于 Web 浏览器或 API 客户端,而不适用于共享代理)。
本项目并未得到积极维护;它能够实现我以及显然其他人希望它实现的功能,因此我认为它已经“完成”了。话虽如此,如果您发现任何问题,请提交一个 Pull Request,我会尝试进行审查。现在起,任何更改公共 API 的变更都不予考虑。
## 缓存后端
- 内置的 'memory' 缓存将响应存储在内存 map 中。
- [`github.com/gregjones/httpcache/diskcache`](https://github.com/gregjones/httpcache/tree/master/diskcache) 使用 [diskv](https://github.com/peterbourgon/diskv) 库提供了一个基于文件系统的缓存。
- [`github.com/gregjones/httpcache/memcache`](https://github.com/gregjones/httpcache/tree/master/memcache) 提供了 memcache 实现,同时支持 App Engine 和“常规”的 memcache 服务器。
- [`sourcegraph.com/sourcegraph/s3cache`](https://sourcegraph.com/github.com/sourcegraph/s3cache) 使用 Amazon S3 进行存储。
- [`github.com/gregjones/httpcache/leveldbcache`](https://github.com/gregjones/httpcache/tree/master/leveldbcache) 使用 [leveldb](https://github.com/syndtr/goleveldb/leveldb) 提供了一个基于文件系统的缓存。
- [`github.com/die-net/lrucache`](https://github.com/die-net/lrucache) 提供了一个内存缓存,它会淘汰最近最少使用的条目。
- [`github.com/die-net/lrucache/twotier`](https://github.com/die-net/lrucache/tree/master/twotier) 允许组合缓存,例如将上述的 lrucache 与持久化磁盘缓存结合使用。
- [`github.com/birkelund/boltdbcache`](https://github.com/birkelund/boltdbcache) 提供了一个 BoltDB 实现(基于 [bbolt](https://github.com/coreos/bbolt) 分支)。
如果您实现了任何其他后端并希望在此处添加链接,请编辑此文件并发送一个 PR。
## 许可证
- [MIT 许可证](LICENSE.txt)
标签:EVTX分析, Go, HTTP RFC, Ruby工具, SOC Prime, 开发工具, 日志审计, 缓存, 网络传输