Skip to content

feat(cache): expose cache property on memoized functions#7045

Open
tomas-zijdemans wants to merge 2 commits intodenoland:mainfrom
tomas-zijdemans:memoize
Open

feat(cache): expose cache property on memoized functions#7045
tomas-zijdemans wants to merge 2 commits intodenoland:mainfrom
tomas-zijdemans:memoize

Conversation

@tomas-zijdemans
Copy link
Contributor

@tomas-zijdemans tomas-zijdemans commented Mar 13, 2026

Exposed the cache as a public property so callers can inspect or manually invalidate the cache (e.g. fn.cache.delete(...), fn.cache.clear()).

Changed MemoizationCache from type alias to interface to align with the style guide

Removed unused import and dropped the lint suppression.

Replaced the cache.has(key) + cache.get(key)! two-step lookup with a single cache.get(key) call. This avoids a redundant lookup on every cache hit.

Simplified tests a lot, maintaining coverage

@tomas-zijdemans tomas-zijdemans requested a review from kt3k as a code owner March 13, 2026 09:24
@github-actions github-actions bot added the cache label Mar 13, 2026
@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.01%. Comparing base (6df7f21) to head (86ce23c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7045      +/-   ##
==========================================
- Coverage   94.01%   94.01%   -0.01%     
==========================================
  Files         627      627              
  Lines       50029    50030       +1     
  Branches     8807     8807              
==========================================
  Hits        47037    47037              
  Misses       2413     2413              
- Partials      579      580       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant