|
| 1 | +# http-cache |
| 2 | + |
| 3 | +[](https://github.com/06chaynes/http-cache/actions/workflows/rust.yml) |
| 4 | +[](https://crates.io/crates/http-cache) |
| 5 | +[](https://docs.rs/http-cache) |
| 6 | +[](https://app.codecov.io/gh/06chaynes/http-cache) |
| 7 | + |
| 8 | + |
| 9 | +<img align="right" src="https://raw.githubusercontent.com/06chaynes/http-cache/latest/.assets/images/http-cache_logo_bluegreen.svg" height="150px" alt="the http-cache logo"> |
| 10 | + |
| 11 | +A caching middleware that follows HTTP caching rules, |
| 12 | +thanks to [http-cache-semantics](https://github.com/kornelski/rusty-http-cache-semantics). |
| 13 | +By default, it uses [cacache](https://github.com/zkat/cacache-rs) as the backend cache manager. |
| 14 | + |
| 15 | +## How do I use this? |
| 16 | + |
| 17 | +Likely you won't! At least not directly. Unless you are looking to implement a custom backend cache manager |
| 18 | +or client middleware you'll probably want to pull in one of the existing client implementations instead. |
| 19 | +See the [Provided Client Implementations](#provided-client-implementations) section below. |
| 20 | + |
| 21 | +## Minimum Supported Rust Version (MSRV) |
| 22 | + |
| 23 | +1.54.0 |
| 24 | + |
| 25 | +## Install |
| 26 | + |
| 27 | +With [cargo add](https://github.com/killercup/cargo-edit#Installation) installed : |
| 28 | + |
| 29 | +```sh |
| 30 | +cargo add http-cache |
| 31 | +``` |
| 32 | + |
| 33 | +## Features |
| 34 | + |
| 35 | +The following features are available. By default `manager-cacache` is enabled. |
| 36 | + |
| 37 | +- `manager-cacache` (default): use [cacache](https://github.com/zkat/cacache-rs), a high-performance disk cache, for the manager backend. |
| 38 | +- `manager-moka` (disabled): use [moka](https://github.com/moka-rs/moka), a high-performance in-memory cache, for the manager backend. |
| 39 | +- `with-http-types` (disabled): enable [http-types](https://github.com/http-rs/http-types) type conversion support |
| 40 | + |
| 41 | +## Documentation |
| 42 | + |
| 43 | +- [API Docs](https://docs.rs/http-cache) |
| 44 | + |
| 45 | +## Provided Client Implementations |
| 46 | + |
| 47 | +- **Surf**: See [README](http-cache-surf/README.md) for more details |
| 48 | +- **Reqwest**: See [README](http-cache-reqwest/README.md) for more details |
| 49 | + |
| 50 | +## License |
| 51 | + |
| 52 | +Licensed under either of |
| 53 | + |
| 54 | +- Apache License, Version 2.0 |
| 55 | + ([LICENSE-APACHE](LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>) |
| 56 | +- MIT license |
| 57 | + ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>) |
| 58 | + |
| 59 | +at your option. |
| 60 | + |
| 61 | +## Contribution |
| 62 | + |
| 63 | +Unless you explicitly state otherwise, any contribution intentionally submitted |
| 64 | +for inclusion in the work by you, as defined in the Apache-2.0 license, shall be |
| 65 | +dual licensed as above, without any additional terms or conditions. |
0 commit comments