Skip to content

Conversation

@raphael
Copy link
Member

@raphael raphael commented Jan 18, 2026

What

This adds TTL support to Pulse replicated maps (rmap) and wires it into streaming sinks to prevent leaked per-stream sink metadata.

  • rmap TTL

    • rmap.WithTTL(ttl) sets an absolute TTL on the backing Redis hash (uses EXPIRENX).
    • rmap.WithSlidingTTL(ttl) sets a sliding TTL (refreshed on every write).
    • TTL is applied after map write operations so it’s set only once the hash exists.
  • streaming sinks

    • When a streaming.Stream is configured with a TTL, streaming.Sink applies the same TTL policy to the per-stream consumers map (stream:<name>:sinks), preventing map:stream:* leaks for TTL’d ephemeral streams.
  • stream deletion hygiene

    • Stream.Destroy() now also clears the per-stream consumers map hash and publishes reset:* on the map channel, mirroring rmap.Destroy semantics.

Docs: updated rmap/README.md with the new TTL options.

Why

In prod we observed a large number of stale map:stream:result:* keys (sink metadata) persisting long after the corresponding result streams were gone. This change makes retention a first-class concept for replicated maps and ties map retention to stream retention for the sink metadata path.

Test evidence

  • go test ./streaming/options -run TestStreamOptions
  • go test ./streaming -run TestOptions

(Full rmap/streaming TTL tests require Redis; CI covers those.)

@raphael raphael enabled auto-merge (squash) January 18, 2026 20:18
@raphael raphael merged commit 0edda2f into main Jan 18, 2026
5 checks passed
@raphael raphael deleted the feat/rmap-ttl branch January 18, 2026 20:20
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