Added cache enablement config with disabled no-op behavior - #749
Open
GoodforGod wants to merge 1 commit into
Open
Added cache enablement config with disabled no-op behavior#749GoodforGod wants to merge 1 commit into
GoodforGod wants to merge 1 commit into
Conversation
Added `enabled` cache configuration for Caffeine and Redis caches with a default-enabled compatibility path. When disabled, cache reads always miss, writes and invalidations become no-ops, and `computeIfAbsent` returns loader results without storing them.
Test Results726 tests 717 ✅ 26m 29s ⏱️ Results for commit 3872a7d. ♻️ This comment has been updated with latest results. |
Dependency Update ReportUpdate level: Found
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added cache enablement config with disabled no-op behavior
EN
Added
enabledcache configuration for Caffeine and Redis caches with default-enabled behavior for backward compatibility. When disabled, cache reads always miss, writes and invalidations are skipped, andcomputeIfAbsentreturns loader results without storing them.RU
Добавлена настройка
enabledдля Caffeine и Redis кешей, по умолчанию кеши остаются включенными для обратной совместимости. При отключении чтение всегда возвращает промах, запись и инвалидация не выполняются, аcomputeIfAbsentвозвращает результат загрузчика без сохранения в кеш.enabledsupport to cache configuration with a default value oftrue, preserving existing behavior unless explicitly disabled.Design
The
enabledflag is owned by provider-specific cache configs:CaffeineCacheConfigandRedisCacheConfig. Both expose a default method returningtrue, so existing applications and generated config mappings keep current behavior without requiring config changes.Runtime cache implementations check the flag before performing cache operations. Disabled caches do not call the underlying Caffeine or Redis client for reads, writes, compute storage, or invalidation, so the cache layer behaves as bypassed.
computeIfAbsentkeeps the application contract useful while disabled: it still invokes the provided loader and returns its result, but does not persist it.Example configuration: