Rishabh Daim created OAK-12147:
----------------------------------
Summary: Introduce Oak Cache API interfaces in oak-core-spi
Key: OAK-12147
URL: https://issues.apache.org/jira/browse/OAK-12147
Project: Jackrabbit Oak
Issue Type: Sub-task
Reporter: Rishabh Daim
Assignee: Rishabh Daim
Introduce a new Oak-owned cache API in oak-core-spi so that all Oak modules can
depend on stable interfaces rather than Guava shim or Caffeine types directly.
New interfaces in org.apache.jackrabbit.oak.cache:
- OakCache<K,V> — base interface: getIfPresent, get(K, Function)
(Caffeine-aligned, unchecked, @Nullable), put, invalidate, invalidateAll,
estimatedSize, asMap, getAllPresent, cleanUp, stats()
- OakLoadingCache<K,V> extends OakCache — get(K) returns @NotNull, throws
CompletionException on loader failure; refresh(K)
- OakCacheLoader<K,V> — functional interface: V load(K) throws Exception
- OakWeigher<K,V> — functional interface: int weigh(K, V)
- OakRemovalCause — enum: EXPLICIT, REPLACED, SIZE, EXPIRED, COLLECTED
- OakRemovalListener<K,V> — functional interface: void onRemoval(K, V,
OakRemovalCause)
- OakCacheStats — immutable value object: hitCount, missCount,
loadSuccessCount, loadFailureCount, totalLoadTime, evictionCount; methods
minus(), hitRate(), missRate(), requestCount()
No changes to AbstractCacheStats, CacheStats, or CacheLIRS. All existing call
sites continue to compile unchanged.
Acceptance criteria:
- oak-core-spi compiles with no new Caffeine or Guava types in the public API
- All existing oak-core-spi tests pass
- No consumer module is changed
--
This message was sent by Atlassian Jira
(v8.20.10#820010)