Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace guava with caffeine. #177

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Replace guava with caffeine. #177

wants to merge 1 commit into from

Conversation

rimasu
Copy link

@rimasu rimasu commented Jun 13, 2023

Caffeine is a focussed library that just provides caching. It has similar behaviour to guava's caching library.

This commit replaces guava's cache with caffeine and remove other minor uses of guava APIs.

Changes

Please describe both what is changing and why this is important. Include:

  • Endpoints added, deleted, deprecated, or changed
    N/A

  • Classes and methods added, deleted, deprecated, or changed

Replaced Guava cache with Caffeine based cached. This is a smaller and more focused library with fewer CVEs and good adoption.

Removed some trivial usages of guava in test code.

  • Screenshots of new or changed UI, if applicable
    N/A

  • A summary of usage if this is a new feature or change to a public API (this should also be added to relevant documentation once released)
    N/A

  • Any alternative designs or approaches considered
    N/A

References

Please include relevant links supporting this change such as a:

  • support ticket
  • community post
  • StackOverflow post
  • support forum thread

Testing

Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

I have replaced the existing test with functionally equivalent tests.

  • This change adds test coverage
  • This change has been tested on the latest version of Java or why not

This has been tested on Java 11 as this is compatible with project's java version (1.8).

Checklist

Caffeine is a focussed library that just provides caching.
It has similar behaviour to guava's caching library.

This commit replaces guava's cache with caffeine and
remove other minor uses of guava APIs.
@rimasu rimasu requested a review from a team as a code owner June 13, 2023 08:41
@rimasu
Copy link
Author

rimasu commented Jun 13, 2023

API comparison is failing because GuavaCachedJwkProvider (that was removed) was public. The usage in this module makes it look like it was designed as an internal implementation, rather than a component to be used else where.

@jimmyjames
Copy link
Contributor

Thanks for the PR @rimasu! We do want to look into Guava alternatives, including Caffeine. As you noted, unfortunately when the library was written it was tightly coupled to Guava, so I think changing it would be a breaking change. As this library is on 0.x, by semantic versioning a breaking change can be introduced, but we'll need to look through the various options and do some comparison before deciding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants