Skip to content

cacheable - fix: ttl in documentation and cascading ttl in set and setMany#1620

Merged
jaredwray merged 3 commits intomainfrom
claude/fix-issue-1619-g3m4v
Apr 16, 2026
Merged

cacheable - fix: ttl in documentation and cascading ttl in set and setMany#1620
jaredwray merged 3 commits intomainfrom
claude/fix-issue-1619-g3m4v

Conversation

@jaredwray
Copy link
Copy Markdown
Owner

The set() and setManyKeyv() methods now correctly follow the
documented TTL priority: explicit function TTL >> store adapter TTL >>
cacheable TTL. Previously, both primary and secondary stores received
the same TTL (cacheable default), ignoring any TTL configured on
individual Keyv store instances.

Also fixes README examples that incorrectly passed { ttl } to
KeyvRedis (which doesn't accept it) — the correct approach is to
wrap KeyvRedis in a Keyv instance with the ttl option.

https://claude.ai/code/session_015CcQfg62CLeeE43HusGV57

claude added 2 commits April 16, 2026 11:43
The `set()` and `setManyKeyv()` methods now correctly follow the
documented TTL priority: explicit function TTL >> store adapter TTL >>
cacheable TTL. Previously, both primary and secondary stores received
the same TTL (cacheable default), ignoring any TTL configured on
individual Keyv store instances.

Also fixes README examples that incorrectly passed `{ ttl }` to
KeyvRedis (which doesn't accept it) — the correct approach is to
wrap KeyvRedis in a Keyv instance with the ttl option.

https://claude.ai/code/session_015CcQfg62CLeeE43HusGV57
Replace inlined TTL priority logic with the existing getCascadingTtl
utility from @cacheable/utils in both set() and setManyKeyv().

https://claude.ai/code/session_015CcQfg62CLeeE43HusGV57
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements cascading TTL logic, allowing primary and secondary stores to utilize their own TTL configurations when an explicit TTL is not provided. The changes include updates to the set and setMany methods, documentation improvements in the README, and new test cases to verify per-store TTL behavior. A significant issue was identified in the set method where the BEFORE_SET hook's modifications to the TTL are ignored when calculating the TTL for the secondary store, potentially causing data inconsistency between layers.

Comment thread packages/cacheable/src/index.ts Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 259a43236d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/cacheable/src/index.ts Outdated
@jaredwray jaredwray changed the title claude/fix-issue-1619-g3m4v cacheable - fix: ttl in documentation and cascading ttl in set and setMany Apr 16, 2026
When the BEFORE_SET hook modifies item.ttl, that override now applies
to the secondary store as well. Previously the secondary TTL was
computed independently, ignoring the hook's modification.

https://claude.ai/code/session_015CcQfg62CLeeE43HusGV57
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (ac27d22) to head (8b6366f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1620   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines         2492      2496    +4     
  Branches       556       555    -1     
=========================================
+ Hits          2492      2496    +4     

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

@jaredwray jaredwray merged commit 46c31cc into main Apr 16, 2026
10 checks passed
@jaredwray jaredwray deleted the claude/fix-issue-1619-g3m4v branch April 16, 2026 12:36
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