Skip to content

Add PSR6 alternative to cache JWKSet - #550

Merged
Spomky merged 1 commit into
web-token:3.4.xfrom
qdequippe:psr-cache-url-key-set
Apr 9, 2024
Merged

Add PSR6 alternative to cache JWKSet#550
Spomky merged 1 commit into
web-token:3.4.xfrom
qdequippe:psr-cache-url-key-set

Conversation

@qdequippe

@qdequippe qdequippe commented Apr 4, 2024

Copy link
Copy Markdown
Contributor
Q A
Branch?
Bug fix? no
New feature? yes
Deprecations? no
Tickets #537
License MIT

Option to rely on PSR Cache instead of HTTP Cache

See #537 for more details

@qdequippe
qdequippe marked this pull request as ready for review April 4, 2024 06:28
Implemented caching in the UrlKeySetFactory to store and retrieve URL data. This is accomplished by adding the PSR Cache package to the composer.json file and incorporating it with the CacheItemPoolInterface in the UrlKeySetFactory class. This addition intends to improve performance by storing data from previous URL requests and reusing them, if available, instead of making repeated URL requests.
@Spomky

Spomky commented Apr 9, 2024

Copy link
Copy Markdown
Member

Hello @qdequippe,

Many thanks for this PR.
I changed your proposal by using the NullAdapter by default to avoid testing the presence of the caching service.
This adapter can be changed with the method enabledCache.
Also, for hasing function is now xxh128 instead of sha1. It is fast, shorter and not broken.

@Spomky Spomky self-assigned this Apr 9, 2024
@Spomky Spomky added this to the 3.4.0 milestone Apr 9, 2024
@Spomky Spomky linked an issue Apr 9, 2024 that may be closed by this pull request
@Spomky
Spomky changed the base branch from 3.3.x to 3.4.x April 9, 2024 10:28
@Spomky
Spomky merged commit 570052b into web-token:3.4.x Apr 9, 2024
@qdequippe
qdequippe deleted the psr-cache-url-key-set branch April 9, 2024 17:05
@jdreesen

jdreesen commented May 6, 2025

Copy link
Copy Markdown
Contributor

I would really like to use this in a Symfony 5.4 project, but this dependency doesn't allow upgrading to ^3.4 of web-token/jwt-library, because Symfony 5.4 only allows ^1.0|^2.0 of psr/cache. Would it be okay to widen it to ^2.0|^3.0?

@Spomky

Spomky commented May 6, 2025

Copy link
Copy Markdown
Member

Hello,
Yes I guess it is acceptable as the interface is identical.

@jdreesen

jdreesen commented May 6, 2025

Copy link
Copy Markdown
Contributor

Great! Here is a PR: #620

@jdreesen jdreesen mentioned this pull request May 7, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC] Option to rely on PSR Cache instead of HTTP Cache

3 participants