Skip to content

chore(deps): bump cache2k 1.6.0.Final → 2.6.1.Final#24095

Open
stian-sandvold wants to merge 1 commit into
masterfrom
cache2k-2.6.1-fix
Open

chore(deps): bump cache2k 1.6.0.Final → 2.6.1.Final#24095
stian-sandvold wants to merge 1 commit into
masterfrom
cache2k-2.6.1-fix

Conversation

@stian-sandvold

Copy link
Copy Markdown
Contributor

What

Bump cache2k 1.6.0.Final → 2.6.1.Final (cache2k-api.version), and remove the single 2.x-incompatible API call so the bump compiles.

Supersedes dependabot #23778, which bumped only the version property and therefore failed to compile (all four CI suites red).

The one breaking change

cache2k 2.x removed Cache2kBuilder.resilienceDuration(long, TimeUnit) (the old behaviour moved to UniversalResiliencePolicy in a separate cache2k-addon module). It is used exactly once, in DefaultPreheatCacheService.put().

That method's cache is disabled dead codeDefaultPreheatCacheService.isCacheEnabled() hardcodes return false ("we decided to deactivate the cache in the preheat completely for now"), so the Cache2kBuilder…build() never runs. The resilience setting was protecting a cache that is never built.

So rather than add a new cache2k-addon dependency just to preserve that setting, this PR simply drops the resilienceDuration call. Minimal diff, no new dependency.

Every other cache2k API dhis2 uses is unchanged in 2.6.1.Final — forUnknownTypes, eternal, expireAfterWrite(long, TimeUnit), entryCapacity, name, permitNullValues, build; Cache.get/put/putIfAbsent/remove/removeAll/clear/keys/asMap/invoke; MutableCacheEntry.setValue().setExpiryTime() — and dhis2 imports nothing from the removed org.cache2k.integration package.

Supply-chain notes

  • Genuine org.cache2k artifacts (Jens Wilke / cache2k.org), on Maven Central since 2022-02-07, PGP-signed.
  • No CVE in either direction (OSV + GitHub Advisory DB clean for 1.6.0.Final and 2.6.1.Final) — not a security-driven bump.
  • Transitive footprint shrinks: 2.x drops 1.6.0's non-optional org.jctools:jctools-core runtime dependency; cache2k 2.6.1 is effectively zero-dependency.
  • Note: 2.6.1.Final (Feb 2022) is cache2k's latest/terminal release — no 3.x, low ongoing maintenance.

Verification (local, off current master)

  • ✅ Compiles: dhis-api, dhis-support-hibernate, dhis-tracker (the three cache2k users) + dependency chain.
  • AnalyticsCacheTest — 6/6 green (exercises a real LocalCache, i.e. the cache2k 2.6.1 get/put/TTL runtime path).
  • AbstractSchemaStrategyCachingTest (tracker) — 2/2 green.

Follow-up (not in this PR)

DefaultPreheatCacheService's cache is entirely disabled and is the only cache2k user in dhis-tracker. A separate cleanup could remove the disabled cache and drop cache2k from the tracker module. (Also: LocalCache/ExtendedCacheBuilder javadocs wrongly say "Caffeine-backed" — the backend is cache2k.)

🤖 Generated with Claude Code

Bump cache2k-api.version and adapt the one breaking API. cache2k 2.x removed
Cache2kBuilder.resilienceDuration(long, TimeUnit) (its UniversalResiliencePolicy
moved to the separate cache2k-addon module). It is used once, in
DefaultPreheatCacheService.put() — whose cache path is currently disabled
(isCacheEnabled() returns false), so the resilience setting protected a cache that
is never built. Removing the call avoids pulling in the new cache2k-addon
dependency for dead code.

No other source change is needed: every other cache2k API dhis2 uses
(forUnknownTypes, eternal, expireAfterWrite(long,TimeUnit), entryCapacity, name,
permitNullValues, build; Cache get/put/putIfAbsent/remove/removeAll/clear/keys/
asMap/invoke + MutableCacheEntry.setExpiryTime) is unchanged in 2.6.1.Final, and
dhis2 imports nothing from the removed org.cache2k.integration package.

Supersedes dependabot #23778 (version-only, did not compile).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@enricocolasante enricocolasante left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We actually have a task to review caching strategy in tracker. We will have a look then if it makes sense to completely remove it or make it work

@sonarqubecloud

sonarqubecloud Bot commented Jun 2, 2026

Copy link
Copy Markdown

@stian-sandvold

Copy link
Copy Markdown
Contributor Author

@enricocolasante Claude was a bit quick on the trigger and automatically tagged you for review before I got a change to research the change.
But after looking through it now, removing this line has no impact, and even if the cache2k code is re-enabled, this line shouldn't have an impact, since we're not using loaders to populate the caches, rather we populate them directly ourselves.

If we do want it back in the future because we want to use loaders, we'd have to include the cache2k-addon dependency as well, which comes with a resilliencePolicy :)

In either case, I think it's fine to merge this, then when the time comes to review the caching in tracker, we can decide whether you need the resillience or not!

@stian-sandvold stian-sandvold enabled auto-merge (squash) June 2, 2026 12:14
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