[package]
name = "tower-http-cache"
version = "0.5.0"
edition = "2021"
rust-version = "1.75.0"
description = "Tower-compatible caching layer with pluggable backends (in-memory, Redis, and more)"
license = "MIT OR Apache-2.0"
repository = "https://github.com/sadco-io/tower-http-cache"
documentation = "https://docs.rs/tower-http-cache"
readme = "README.md"
exclude = ["._*", "**/.DS_Store", ".cursor/"]
keywords = ["tower", "cache", "middleware", "http"]
categories = ["web-programming", "caching"]
authors = ["Daniel Curtis <drc@danielryancurtis.com>"]

[dependencies]
tower = { version = "0.5", default-features = false, features = ["util"] }
http = { version = "1.3", default-features = false }
http-body = "1.0"
http-body-util = "0.1"
async-trait = "0.1"
bytes = "1.7"
tokio = { version = "1.40", features = ["sync", "rt", "time", "macros"] }
serde = { version = "1.0", features = ["derive"], optional = true }
serde_json = { version = "1.0", optional = true }
moka = { version = "0.12", optional = true, features = ["future"] }
redis = { version = "0.32.7", features = ["aio", "tokio-comp", "connection-manager"], optional = true }
tokio-util = { version = "0.7", optional = true }
async-memcached = { version = "0.5", optional = true }
bb8 = { version = "0.8", optional = true }
metrics = { version = "0.24", optional = true }
pin-project-lite = "0.2"
thiserror = "2.0"
dashmap = "5.5"
futures-util = { version = "0.3", default-features = false, features = ["alloc"] }
bincode = { version = "1.3.3", optional = true }
tracing = { version = "0.1", optional = true }
flate2 = { version = "1.0", optional = true, default-features = false, features = ["rust_backend"] }
uuid = { version = "1.0", features = ["v4", "serde"] }
sha2 = "0.10"
hex = "0.4"
chrono = "0.4"
axum = { version = "0.8", optional = true }
governor = { version = "0.6", optional = true }

[features]
default = ["in-memory", "serde"]
in-memory = ["moka"]
redis-backend = ["redis", "tokio-util", "serde", "dep:bincode"]
memcached-backend = ["async-memcached", "serde", "dep:bincode", "dep:bb8"]
serde = ["dep:serde", "dep:serde_json", "dep:bincode"]
metrics = ["dep:metrics"]
tracing = ["dep:tracing"]
compression = ["dep:flate2"]
admin-api = ["dep:axum", "dep:governor"]

[dev-dependencies]
tokio = { version = "1.40", features = ["full"] }
tower = { version = "0.5", features = ["util"] }
http-body-util = "0.1"
axum = "0.8.6"
redis = { version = "0.32.7", features = ["aio", "tokio-comp", "connection-manager"] }
tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter"] }
criterion = { version = "0.7", features = ["html_reports"] }

[[bench]]
name = "cache_benchmarks"
harness = false
