Skip to content

Added cache enablement config with disabled no-op behavior - #749

Open
GoodforGod wants to merge 1 commit into
masterfrom
feature/cache-config-enabled
Open

Added cache enablement config with disabled no-op behavior#749
GoodforGod wants to merge 1 commit into
masterfrom
feature/cache-config-enabled

Conversation

@GoodforGod

@GoodforGod GoodforGod commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Added cache enablement config with disabled no-op behavior

EN

Added enabled cache configuration for Caffeine and Redis caches with default-enabled behavior for backward compatibility. When disabled, cache reads always miss, writes and invalidations are skipped, and computeIfAbsent returns loader results without storing them.


RU

Добавлена настройка enabled для Caffeine и Redis кешей, по умолчанию кеши остаются включенными для обратной совместимости. При отключении чтение всегда возвращает промах, запись и инвалидация не выполняются, а computeIfAbsent возвращает результат загрузчика без сохранения в кеш.


  • Added enabled support to cache configuration with a default value of true, preserving existing behavior unless explicitly disabled.

Design

The enabled flag is owned by provider-specific cache configs: CaffeineCacheConfig and RedisCacheConfig. Both expose a default method returning true, 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.

computeIfAbsent keeps the application contract useful while disabled: it still invokes the provided loader and returns its result, but does not persist it.

Example configuration:

cache:
  myCache:
    enabled: false

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.
@GoodforGod GoodforGod added this to the v2.0.0 milestone Jul 23, 2026
@GoodforGod GoodforGod added new feature New feature request module: cache Related to Cache module labels Jul 23, 2026
@GoodforGod
GoodforGod requested a review from Squiry July 23, 2026 22:06
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

Test Results

726 tests   717 ✅  26m 29s ⏱️
 99 suites    9 💤
 99 files      0 ❌

Results for commit 3872a7d.

♻️ This comment has been updated with latest results.

@github-actions

Copy link
Copy Markdown

Dependency Update Report

Update level: patch

Found 3 dependency updates.

gradle/libs.versions.toml

  • s3client-aws (software.amazon.awssdk:s3, inline:248): 2.47.5 -> 2.47.6
  • zeebe: 8.9.12 -> 8.9.13
  • kotlin-stdlib: 2.4.0 -> 2.4.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: cache Related to Cache module new feature New feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant