Keats / jsonwebtoken

JWT lib in rust
MIT License
1.64k stars 260 forks source link

Verify operations caching #296

Closed nebarf closed 1 year ago

nebarf commented 1 year ago

Adding an optional caching layer when decoding JWTs should provide a performance boost on application level since servers tend to process same tokens multiple times.

The idea could be to implement such layer based on a LRU cache with a configurable capacity. Also the cache TTL should take into account time-sensitive claims (i.e. nbf, exp and iat) to guarantee the verification is retried when a token expires or becomes valid.

Keats commented 1 year ago

That's something that should be done by the app, not by the library.