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.
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 cacheTTL
should take into account time-sensitive claims (i.e.nbf
,exp
andiat
) to guarantee the verification is retried when a token expires or becomes valid.