Skip to content

fix(core): allow zero max size caches across providers #173

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

Merged
merged 2 commits into from
Sep 24, 2023

Conversation

iProdigy
Copy link
Member

@iProdigy iProdigy commented Sep 24, 2023

Some users may do maxSize(0L) or expiryTime(Duration.ZERO) to "disable" caching.

However, this is not supported by all of the underlying providers: https://togithub.com/FasterXML/jackson-databind/pull/4115#discussion_r1335062530

This PR returns EmptyCache.INSTANCE in these scenarios to avoid exceptions/inconsistency across providers.

@iProdigy
Copy link
Member Author

iProdigy commented Sep 24, 2023

Open question: Users may assume compute, computeIfAbsent, merge always yield not-null values - should we evaluate (and return) the value from the passed lambdas instead of null (despite never writing the value)?

Edit: actually this behavior could be interpreted as performing a write & immediately evicting it, so I will proceed with the patch

Copy link
Member Author

@iProdigy iProdigy left a comment

Choose a reason for hiding this comment

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

for example:

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@iProdigy iProdigy merged commit a5547c5 into main Sep 24, 2023
@iProdigy iProdigy deleted the fix/cache-zero-max-size-time branch September 24, 2023 16:22
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.

2 participants