Skip to content

feat(cache/unstable): add peek() to TtlCache#7070

Merged
bartlomieju merged 1 commit intodenoland:mainfrom
tomas-zijdemans:ttl-peek
Mar 30, 2026
Merged

feat(cache/unstable): add peek() to TtlCache#7070
bartlomieju merged 1 commit intodenoland:mainfrom
tomas-zijdemans:ttl-peek

Conversation

@tomas-zijdemans
Copy link
Copy Markdown
Contributor

Adding peek to TtlCache, as the only way to read without side effects bringing symmetry with LruCache.

Both caches have a "read touches state" method (get). For LRU, get promotes. For TTL with sliding expiration, get resets the timer.

... and now both have a "read without touching state" method (peek).

Note: Also fixes the bug introduced here, where the input validation was happening too late.

@github-actions github-actions Bot added the cache label Mar 27, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.41%. Comparing base (008db8d) to head (be3156d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7070   +/-   ##
=======================================
  Coverage   94.41%   94.41%           
=======================================
  Files         630      630           
  Lines       50486    50490    +4     
  Branches     8946     8949    +3     
=======================================
+ Hits        47666    47670    +4     
  Misses       2249     2249           
  Partials      571      571           

☔ 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.

Copy link
Copy Markdown
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

Thanks!

@bartlomieju bartlomieju merged commit 1cd63ca into denoland:main Mar 30, 2026
19 checks passed
tomas-zijdemans added a commit to tomas-zijdemans/std_cb that referenced this pull request Mar 30, 2026
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.

2 participants