Skip to content

OAK-11946 : migrate cache APIs to Caffeine#2807

Open
rishabhdaim wants to merge 7 commits intotrunkfrom
OAK-11946
Open

OAK-11946 : migrate cache APIs to Caffeine#2807
rishabhdaim wants to merge 7 commits intotrunkfrom
OAK-11946

Conversation

@rishabhdaim
Copy link
Contributor

@rishabhdaim rishabhdaim commented Mar 19, 2026

Summary

Migrates all Guava cache API usages to Caffeine (com.github.benmanes.caffeine) across the Oak codebase.

Changes

  • oak-core-spi: CacheLIRS, CacheStats, AbstractCacheStats, EmpiricalWeigher — replace Guava Cache/CacheBuilder/Weigher/CacheStats; bump package-info.java version
  • oak-store-document: DocumentNodeStore, DocumentNodeStoreBuilder, NodeDocumentCache, NodeCache, PersistentCache, CachingCommitValueResolver, LocalDiffCache, MemoryDiffCache, TieredDiffCache, NodeDocument, ForwardingListener, EvictionListener — replace Guava cache imports; adapt CallableFunction, reload()asyncReload()
  • oak-segment-tar: SegmentCache, ReaderCache, RecordCache, WriterCacheManager, PriorityCache, CacheWeights, RecordCacheStats, SegmentCacheStats — replace Guava cache imports; add .executor(Runnable::run) and cleanUp() for synchronous eviction
  • oak-blob-plugins: FileCache, CompositeDataStoreCache, UploadStagingCache, CachingBlobStore, AbstractSharedCachingDataStore, DataStoreBlobStore — replace Guava Cache/CacheBuilder/CacheLoader/AbstractCache/Weigher/RemovalCause
  • oak-blob: BlobIdSet — replace CacheBuilder with Caffeine
  • oak-blob-cloud: S3Backend — replace CacheBuilder with Caffeine
  • oak-blob-cloud-azure: AzureBlobStoreBackend, AzureBlobStoreBackendV8 — replace CacheBuilder with Caffeine
  • oak-search: ExtractedTextCache — replace Guava Cache/CacheBuilder/Weigher with Caffeine
  • oak-search-elastic: ElasticIndexStatistics — replace CacheBuilder/CacheLoader/LoadingCache/Ticker; reload()asyncReload() returning CompletableFuture; getUnchecked()get()
  • oak-run-commons: DocumentNodeStoreHelper — replace Guava Cache import
  • oak-benchmarks: PersistentCacheTest — replace Guava Cache import
  • oak-core: CacheStatsMetricsTest — adapt to Caffeine CacheStats.of()
  • pom.xml (oak-blob, oak-blob-cloud, oak-blob-cloud-azure, oak-search, oak-search-elastic, oak-run-commons, oak-benchmarks) — add Caffeine dependency

Test Plan

  • mvn test -pl oak-core-spi — CacheLIRS, CacheStats tests
  • mvn test -pl oak-store-document — NodeCache, DocumentNodeStore, persistent cache tests
  • mvn test -pl oak-segment-tar — SegmentCache, PriorityCache tests
  • mvn test -pl oak-blob-plugins — FileCache, CompositeDataStoreCache tests
  • mvn test -pl oak-search-elastic — ElasticIndexStatistics tests

Links

Copy link
Contributor

@reschke reschke left a comment

Choose a reason for hiding this comment

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

  1. We should do this in smaller pieces; easier to review. Let's start with oak-store-document.
  2. If we just replace we just swapped one present problem with a potential future one. We need to get rid of Oak APIs that depend on an implementation that we do not control. In practice this means that we need to define an Oak caching API, and implement wrappers.

@rishabhdaim
Copy link
Contributor Author

@reschke how would you suggest to split this ? we are only removing one guava import and rest all the linked to it.

@rishabhdaim rishabhdaim requested a review from reschke March 21, 2026 03:45
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
62.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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