Expand description
JWT validation result cache
Caches the outcome of JWT validation so that repeated requests with the same token do not re-parse and re-verify the signature every time.
Uses the moka crate for a lock-free, concurrent, bounded cache with
time-based expiration. The cache key is the raw token string and the
value is the validated AuthResult.
§Capacity
The maximum number of entries is controlled by
AppConfig::jwt_cache_max_entries (default 1000).
§TTL
Each entry’s TTL is derived from the token’s exp claim:
- If
expis present and in the future, TTL =exp - now. - Otherwise, a default TTL of 5 minutes is used.
Entries are never stored longer than the max TTL cap of 1 hour.
Structs§
- JwtCache
- Thread-safe JWT cache backed by Moka.