[package]
edition = "2024"
name = "multi-tier-cache"
version = "0.6.4"
authors = ["thichuong <thichuong22022000@gmail.com>"]
build = false
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "Customizable multi-tier cache with L1 (Moka in-memory) + L2 (Redis distributed) defaults, expandable to L3/L4+, cross-instance invalidation via Pub/Sub, stampede protection, and flexible TTL scaling"
documentation = "https://docs.rs/multi-tier-cache"
readme = "README.md"
keywords = [
"cache",
"redis",
"memcached",
"multi-tier",
"backends",
]
categories = [
"caching",
"asynchronous",
"database",
]
license = "MIT OR Apache-2.0"
repository = "https://github.com/thichuong/multi-tier-cache"
[features]
backend-memcached = []
backend-quickcache = []
bincode = ["dep:bincode"]
default = [
"moka",
"redis",
]
full = [
"moka",
"redis",
"bincode",
"msgpack",
"memcached",
"quick_cache",
]
memcached = [
"dep:memcache",
"backend-memcached",
]
moka = ["dep:moka"]
msgpack = ["dep:rmp-serde"]
quick_cache = [
"dep:quick_cache",
"backend-quickcache",
]
redis = ["dep:redis"]
[lib]
name = "multi_tier_cache"
path = "src/lib.rs"
[[example]]
name = "advanced_usage"
path = "examples/advanced_usage.rs"
[[example]]
name = "basic_usage"
path = "examples/basic_usage.rs"
[[example]]
name = "builtin_backends"
path = "examples/builtin_backends.rs"
[[example]]
name = "cache_strategies"
path = "examples/cache_strategies.rs"
[[example]]
name = "custom_backends"
path = "examples/custom_backends.rs"
[[example]]
name = "database_caching"
path = "examples/database_caching.rs"
[[example]]
name = "health_monitoring"
path = "examples/health_monitoring.rs"
[[example]]
name = "multi_tier_usage"
path = "examples/multi_tier_usage.rs"
[[example]]
name = "probabilistic_promotion"
path = "examples/probabilistic_promotion.rs"
[[example]]
name = "redis_streams"
path = "examples/redis_streams.rs"
[[example]]
name = "stampede_protection"
path = "examples/stampede_protection.rs"
[[example]]
name = "tracing_demo"
path = "examples/tracing_demo.rs"
[[test]]
name = "integration_basic"
path = "tests/integration_basic.rs"
[[test]]
name = "integration_features"
path = "tests/integration_features.rs"
[[test]]
name = "integration_invalidation"
path = "tests/integration_invalidation.rs"
[[test]]
name = "integration_multi_tier"
path = "tests/integration_multi_tier.rs"
[[test]]
name = "integration_stampede"
path = "tests/integration_stampede.rs"
[[test]]
name = "integration_streams"
path = "tests/integration_streams.rs"
[[bench]]
name = "cache_operations"
path = "benches/cache_operations.rs"
harness = false
[[bench]]
name = "invalidation"
path = "benches/invalidation.rs"
harness = false
[[bench]]
name = "multi_tier"
path = "benches/multi_tier.rs"
harness = false
[[bench]]
name = "serialization"
path = "benches/serialization.rs"
harness = false
[[bench]]
name = "stampede_protection"
path = "benches/stampede_protection.rs"
harness = false
[[bench]]
name = "storm_requests"
path = "benches/storm_requests.rs"
harness = false
[dependencies.anyhow]
version = "1.0"
[dependencies.async-trait]
version = "0.1"
[dependencies.bincode]
version = "1.3"
optional = true
[dependencies.bytes]
version = "1.5"
[dependencies.dashmap]
version = "5.5"
[dependencies.futures-util]
version = "0.3"
[dependencies.memcache]
version = "0.17"
optional = true
[dependencies.moka]
version = "0.12"
features = ["future"]
optional = true
[dependencies.parking_lot]
version = "0.12"
[dependencies.quick_cache]
version = "0.6"
optional = true
[dependencies.rand]
version = "0.8"
[dependencies.redis]
version = "1.0"
features = [
"tokio-comp",
"streams",
"connection-manager",
]
optional = true
[dependencies.rmp-serde]
version = "1.1"
optional = true
[dependencies.serde]
version = "1.0"
features = ["derive"]
[dependencies.serde_bytes]
version = "0.11"
[dependencies.serde_json]
version = "1.0"
[dependencies.thiserror]
version = "1.0"
[dependencies.tokio]
version = "1.36"
features = ["full"]
[dependencies.tracing]
version = "0.1"
[dependencies.tracing-subscriber]
version = "0.3"
features = ["env-filter"]
[dependencies.uuid]
version = "1.7"
features = ["v4"]
[dev-dependencies.criterion]
version = "0.5"
features = ["async_tokio"]
[dev-dependencies.reqwest]
version = "0.12"
features = [
"json",
"blocking",
]
[dev-dependencies.tokio]
version = "1.36"
features = ["full"]
[lints.clippy]
expect_used = "warn"
indexing_slicing = "warn"
pedantic = "warn"
unwrap_used = "warn"