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 all instances of Guava cache with Caffeine #3206

Merged
merged 6 commits into from
Mar 3, 2023

Conversation

cshannon
Copy link
Contributor

Caffeine is the replacement for the Guava cache api and has several improvements including efficiency with its admission policy and performance. Currently the Accumulo code base has a mixture where some places use Guava and some places use Caffeine so it is not consistent. Switching to Caffeine is nearly a drop in replacement and this commit replaces all instances of Guava with Caffeine for consistency and also adds a checkstyle rule to prevent using Guava in the future.

From the Guava docs regarding Caffeine:

Prefer Caffeine over Guava's caching API
The successor to Guava's caching API is Caffeine. Its API is designed to make it a nearly drop-in replacement -- though it requires Java 8 APIs, is not available for Android or GWT/j2cl, and may have different (usually better) behavior when multiple threads attempt concurrent mutations. Its equivalent to CacheBuilder is its Caffeine class. Caffeine offers better performance, more features (including asynchronous loading), and fewer bugs.

Caffeine is the replacement for Guava and has several improvements. This
commit replaces all instances of Guava with Caffeine for consistency and
also adds a checkstyle rule to prevent using Guava in the future.
@cshannon cshannon self-assigned this Feb 25, 2023
Copy link
Contributor

@dlmarion dlmarion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dlmarion
Copy link
Contributor

Kicked off full IT build

@dlmarion
Copy link
Contributor

Full IT build passed successfully

@cshannon cshannon merged commit 65034b6 into apache:main Mar 3, 2023
Copy link
Member

@ctubbsii ctubbsii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After merge review for follow-up changes.

cshannon added a commit to cshannon/accumulo that referenced this pull request Mar 3, 2023
* Narrow catch block for exception handling to only UncheckedIOException
* Fix google cache regex in checkstyle rules
cshannon added a commit that referenced this pull request Mar 3, 2023
* Narrow catch block for exception handling to only UncheckedIOException
* Fix google cache regex in checkstyle rules
asfgit pushed a commit that referenced this pull request Mar 7, 2023
Remove unused ignored variable added by #3206
@cshannon cshannon deleted the caffeine-cache branch March 17, 2023 17:48
@ctubbsii ctubbsii added this to the 3.0.0 milestone Jul 12, 2024
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.

4 participants