Skip to content

chore(base-foundation): replace Memoizer with a typed hierarchy and builder#93

Merged
deer merged 1 commit into
mainfrom
better_memoizer
Jun 28, 2026
Merged

chore(base-foundation): replace Memoizer with a typed hierarchy and builder#93
deer merged 1 commit into
mainfrom
better_memoizer

Conversation

@deer

@deer deer commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator
  • Deletes the single build.base.foundation.Memoizer class and replaces it with a new build.base.foundation.memoizer package containing a Memoizer<T,R> interface, a fluent builder, and six concrete implementations covering every combination of reference mode (strong / soft / weak) and threading model (concurrent / non-concurrent).
  • The builder API is Memoizer.of(fn).soft().concurrent().build() — reference mode and concurrency are opt-in, making intent explicit at each call site.
  • AbstractConcurrentMemoizer uses a per-key ReentrantLock rather than ConcurrentHashMap.computeIfAbsent for the value cache, which allows memoized functions to safely re-enter the memoizer for keys that share a hash bin without deadlocking.
  • All call sites in Introspection and AbstractHeapBasedIndex are updated to the new API; tests are expanded to a parameterized suite covering all six implementations, including concurrent-load and re-entrancy scenarios.

@deer deer merged commit 9d7c33e into main Jun 28, 2026
3 checks passed
@deer deer deleted the better_memoizer branch June 28, 2026 09:43
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.

1 participant