hitbox-actix
Hitbox-Actix is an asynchronous caching framework for Actix actor framework. It's designed for distributed and for single-machine applications.
Features
- Automatic cache key generation.
- Multiple cache backend implementations.
- Stale cache mechanics.
- Cache locks for dogpile effect preventions.
- Distributed cache locks.
- Detailed metrics out of the box.
Backend implementations
- Redis
- In-memory backend
Feature flags
- derive - Support for Cacheable trait derive macros.
- redis - Support for default redis backend.
Restrictions
Default cache key implementation based on serde_qs crate and have some restrictions.
Documentation
Flow diagrams:
Example
Dependencies:
[]
= "0.1"
Code:
First, you should derive Cacheable trait for your actix Message:
use *;
use ;
use *;
use ;
;
;
Next step is declare Upstream actor and implement actix Handler for Ping:
;
The last step is initialize and start CacheActor and UpstreamActor:
use EnvFilter;
async