Expand description
Service pattern integration for cache backends.
This crate provides ServiceAdapter to convert any Service<CacheOperation> into
a CacheTier, enabling service middleware composition
(retry, timeout, circuit breaker) for cache storage backends.
§Overview
The adapter provides bidirectional integration:
- Service → Cache: Use
ServiceAdapterto wrap services as cache tiers - Cache → Service: The main
cachet::CacheimplementsService<CacheOperation>
§Quick Start
ⓘ
// Any Service<CacheOperation> can become a cache tier
let tier = ServiceAdapter::new(my_service);§Use Cases
- Remote caches: Wrap Redis, Memcached, or custom services as cache tiers
- Middleware composition: Add retry, timeout, or circuit breaker before caching
- Unified abstractions: Use the same service patterns for caching and other I/O
Structs§
- GetRequest
- Request to get a value from the cache.
- Insert
Request - Request to insert a value into the cache.
- Invalidate
Request - Request to invalidate (remove) a value from the cache.
- Service
Adapter - Adapter that converts a
Service<CacheOperation>into aCacheTier.
Enums§
- Cache
Operation - A cache operation request.
- Cache
Response - Response from a cache operation.
Traits§
- Cache
Service Ext - Extension trait providing ergonomic cache methods for any
Service<CacheOperation>.