Expand description
CacheKit — caching for Rust.
Supports cachekit.io SaaS, Redis, Memcached, local File, and Cloudflare Workers backends. Zero-knowledge encryption via AES-256-GCM with HKDF key derivation.
Re-exports§
pub use client::CacheKit;pub use client::CacheKitBuilder;pub use client::SwrRead;pub use client::SwrToken;pub use config::CachekitConfig;pub use error::BackendError;pub use error::BackendErrorKind;pub use error::CachekitError;pub use client::SecureCache;pub use encryption::EncryptionLayer;pub use flight::SingleFlight;pub use reliability::BackpressureConfig;pub use reliability::CircuitBreakerConfig;pub use reliability::ReliabilityConfig;pub use reliability::RetryConfig;
Modules§
- backend
- Pluggable cache backend trait and implementations (CachekitIO, Redis, Memcached, File, Workers).
- client
- High-level cache client with dual-layer (L1/L2) support.
- config
- Configuration types and environment variable parsing.
- encryption
- Client-side AES-256-GCM encryption with HKDF key derivation. Zero-knowledge encryption layer using AES-256-GCM with AAD v0x03 format.
- error
- Error types for cache operations and backend communication.
- flight
- Cold-miss single-flight: dedup concurrent fills of the same key. Cold-miss single-flight: dedup concurrent fills of the same key.
- interop
- Interop mode (interop/v1): cross-SDK cache keys and plain-MessagePack values. Interop mode (interop/v1): language-neutral cache keys and plain-MessagePack values.
- l1
- In-process L1 cache backed by
mokawith per-entry TTL. - metrics
- L1 cache hit-rate metrics for CachekitIO request headers.
- prelude
- Convenient glob import for the most common types.
- reliability
- Reliability tier: retry with backoff + jitter, circuit breaker. Reliability tier: backpressure (bounded backend concurrency), retry with exponential backoff + jitter, and a closed/open/half-open circuit breaker around backend operations.
- serializer
- Serialization and deserialization of cached values via MessagePack.
- session
- SDK session tracking (session ID and start timestamp).
- url_
validator - SSRF-safe URL validation for CachekitIO endpoints.