Skip to content

RcMap: support dynamic idleTimeToLive values per key - #5859

Merged
tim-smart merged 2 commits into
next-minorfrom
rcmap-dynamic-idle-ttl
Dec 3, 2025
Merged

tim-smart merged 2 commits into
next-minorfrom
rcmap-dynamic-idle-ttl

Conversation

@schickling

Copy link
Copy Markdown
Contributor

Summary

  • Add support for dynamic idleTimeToLive values in RcMap - the option can now be a function that receives the key and returns a duration
  • Store per-entry TTL at acquisition time, allowing different keys to have different idle timeouts
  • Update touch function to use per-entry TTL

Closes #5858

Example

const map = yield* RcMap.make({
  lookup: (key: string) => acquireResource(key),
  idleTimeToLive: (key: string) => {
    if (key.startsWith("premium:")) return Duration.minutes(10)
    return Duration.minutes(1)
  }
})

Test plan

  • Added test for dynamic idleTimeToLive - verifies different keys get different TTLs
  • Added test for touch with dynamic TTL - verifies touch extends expiration using per-entry TTL
  • Existing tests pass

🤖 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Dec 3, 2025 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2dd2636

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
effect Minor
@effect/cli Major
@effect/cluster Major
@effect/experimental Major
@effect/opentelemetry Major
@effect/platform-browser Major
@effect/platform-bun Major
@effect/platform-node-shared Major
@effect/platform-node Major
@effect/platform Major
@effect/printer-ansi Major
@effect/printer Major
@effect/rpc Major
@effect/sql-clickhouse Major
@effect/sql-d1 Major
@effect/sql-drizzle Major
@effect/sql-kysely Major
@effect/sql-libsql Major
@effect/sql-mssql Major
@effect/sql-mysql2 Major
@effect/sql-pg Major
@effect/sql-sqlite-bun Major
@effect/sql-sqlite-do Major
@effect/sql-sqlite-node Major
@effect/sql-sqlite-react-native Major
@effect/sql-sqlite-wasm Major
@effect/sql Major
@effect/typeclass Major
@effect/vitest Major
@effect/workflow Major
@effect/ai Major
@effect/ai-amazon-bedrock Major
@effect/ai-anthropic Major
@effect/ai-google Major
@effect/ai-openai Major
@effect/ai-openrouter Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-bot
effect-bot changed the base branch from main to next-minor December 3, 2025 14:51
@effect-bot effect-bot added the v3/next-minor Queues this PR for the next Effect V3 minor release. label Dec 3, 2025
@schickling
schickling requested a review from tim-smart December 3, 2025 15:09
@tim-smart
tim-smart merged commit dd414da into next-minor Dec 3, 2025
@tim-smart
tim-smart deleted the rcmap-dynamic-idle-ttl branch December 3, 2025 20:19
@effect-bot effect-bot mentioned this pull request Dec 3, 2025
effect-bot pushed a commit that referenced this pull request Dec 4, 2025
effect-bot pushed a commit that referenced this pull request Dec 5, 2025
effect-bot pushed a commit that referenced this pull request Dec 5, 2025
effect-bot pushed a commit that referenced this pull request Dec 6, 2025
effect-bot pushed a commit that referenced this pull request Dec 9, 2025
effect-bot pushed a commit that referenced this pull request Dec 9, 2025
effect-bot pushed a commit that referenced this pull request Dec 9, 2025
effect-bot pushed a commit that referenced this pull request Dec 9, 2025
effect-bot pushed a commit that referenced this pull request Dec 9, 2025
effect-bot pushed a commit that referenced this pull request Dec 10, 2025
effect-bot pushed a commit that referenced this pull request Dec 10, 2025
effect-bot pushed a commit that referenced this pull request Dec 10, 2025
effect-bot pushed a commit that referenced this pull request Dec 10, 2025
effect-bot pushed a commit that referenced this pull request Dec 10, 2025
effect-bot pushed a commit that referenced this pull request Dec 12, 2025
effect-bot pushed a commit that referenced this pull request Dec 12, 2025
effect-bot pushed a commit that referenced this pull request Dec 13, 2025
effect-bot pushed a commit that referenced this pull request Jan 2, 2026
effect-bot pushed a commit that referenced this pull request Jan 3, 2026
effect-bot pushed a commit that referenced this pull request Jan 4, 2026
effect-bot pushed a commit that referenced this pull request Jan 5, 2026
effect-bot pushed a commit that referenced this pull request Jan 5, 2026
effect-bot pushed a commit that referenced this pull request Jan 5, 2026
effect-bot pushed a commit that referenced this pull request Jan 6, 2026
effect-bot pushed a commit that referenced this pull request Jan 6, 2026
effect-bot pushed a commit that referenced this pull request Jan 9, 2026
effect-bot pushed a commit that referenced this pull request Jan 14, 2026
effect-bot pushed a commit that referenced this pull request Jan 16, 2026
effect-bot pushed a commit that referenced this pull request Jan 18, 2026
effect-bot pushed a commit that referenced this pull request Jan 19, 2026
effect-bot pushed a commit that referenced this pull request Jan 20, 2026
effect-bot pushed a commit that referenced this pull request Jan 21, 2026
effect-bot pushed a commit that referenced this pull request Jan 21, 2026
effect-bot pushed a commit that referenced this pull request Jan 22, 2026
effect-bot pushed a commit that referenced this pull request Jan 22, 2026
effect-bot pushed a commit that referenced this pull request Jan 22, 2026
effect-bot pushed a commit that referenced this pull request Jan 26, 2026
effect-bot pushed a commit that referenced this pull request Feb 3, 2026
effect-bot pushed a commit that referenced this pull request Feb 3, 2026
effect-bot pushed a commit that referenced this pull request Feb 3, 2026
effect-bot pushed a commit that referenced this pull request Feb 4, 2026
effect-bot pushed a commit that referenced this pull request Feb 4, 2026
effect-bot pushed a commit that referenced this pull request Feb 4, 2026
effect-bot pushed a commit that referenced this pull request Feb 4, 2026
effect-bot pushed a commit that referenced this pull request Feb 5, 2026
effect-bot pushed a commit that referenced this pull request Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3/next-minor Queues this PR for the next Effect V3 minor release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RcMap: Support dynamic idleTimeToLive values per key

3 participants