Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

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

Merged
iProdigy merged 2 commits intomainXanthic/cache-api:mainfrom
fix/cache-zero-max-size-timeXanthic/cache-api:fix/cache-zero-max-size-timeCopy head branch name to clipboard
Sep 24, 2023
Merged

fix(core): allow zero max size caches across providers#173
iProdigy merged 2 commits intomainXanthic/cache-api:mainfrom
fix/cache-zero-max-size-timeXanthic/cache-api:fix/cache-zero-max-size-timeCopy head branch name to clipboard

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:

Signed-off-by: iProdigy <8106344+iProdigy@users.noreply.github.com>
@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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.