Repository navigation
feat(time-series): add TS.READ cursor read command - #3322
Merged
Merged
Conversation
Add client support for the RedisTimeSeries TS.READ command (since 8.10.0), a read-only, single-key cursor reader that returns a batch of (timestamp, value) samples with timestamp at or after a cursor, in ascending order. Wire shape: TS.READ key timestamp [BLOCK milliseconds min_count] [MAX_COUNT max_count]. The timestamp cursor accepts a non-negative integer or one of the sentinels -, +, $ (exposed as TS_READ_TIMESTAMP). The BLOCK group is all-or-nothing; minCount is optional in the typed API (defaults to 1) but always emitted on the wire. Replies reuse the existing TS.RANGE sample parser for RESP2 and RESP3. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- re-export TS_READ_TIMESTAMP/TsReadTimestamp/TsReadOptions from
package entry; JSDoc {@link} target was unreachable for users
- narrow TsReadTimestamp to number | Date | sentinels: bare string
in Timestamp absorbed the literals, any string compiled
- add integration tests for LATEST/NEW sentinels and BLOCK
(synchronous path + timeout empty flush)
nkaradzhov
marked this pull request as ready for review
July 9, 2026 08:01
PavelPashov
approved these changes
Jul 13, 2026
Reuse the existing `Timestamp` type (number | Date | string) for `TsReadTimestamp` so cursors beyond `Number.MAX_SAFE_INTEGER` can be passed as strings, while keeping the `TS_READ_TIMESTAMP` sentinel literals for autocomplete. Add an arg test covering a string cursor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PavelPashov
approved these changes
Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds client support for the RedisTimeSeries
TS.READcommand (since 8.10.0), a read-only, single-key cursor reader that returns a batch of(timestamp, value)samples with timestamp at or after a cursor, in ascending order. With the optionalBLOCKgroup it waits until at leastminCountqualifying samples exist or a timeout elapses, enabling continuous batch consumption of historical and newly appended samples without pollingTS.RANGE.Wire shape:
TS.READ key timestamp [BLOCK milliseconds min_count] [MAX_COUNT max_count]. Thetimestampcursor accepts a non-negative integer or one of the sentinels-/+/$(exposed asTS_READ_TIMESTAMP). TheBLOCKgroup is all-or-nothing;minCountmay be omitted in the typed API (defaults to1) but is always emitted on the wire. Replies reuse the existingTS.RANGEsample parser (RESP2/RESP3).Behavior considerations:
dont_cache); cluster clients route by the key's hash slot.BLPOP); the command object carries no blocking flag. Callers opting intoBLOCKshould run it on an isolated connection.🤖 Generated with Claude Code
Note
Low Risk
Additive read-only API with no changes to existing commands; blocking behavior matches other blocking Redis commands and is caller-managed.
Overview
Adds client support for RedisTimeSeries
TS.READ(Redis 8.10+): a read-only, single-key cursor read that returns ascending(timestamp, value)batches from an inclusive cursor, with optionalBLOCK(wait forminCount, default 1) andMAX_COUNT.The new
READcommand module exposesTS_READ_TIMESTAMPsentinels (-,+,$), typedTsReadTimestamp/TsReadOptions, and wiresclient.ts.read/READinto the time-series command map. Replies reuse the existingTS.RANGEsample transformers for RESP2/RESP3.Tests cover argument encoding (cursors, precision-safe string timestamps,
BLOCK/MAX_COUNT) and integration cases (full read, caps, missing key,LATEST, blocking whenminCountis already met, empty flush onNEW+BLOCKtimeout).Reviewed by Cursor Bugbot for commit 79ae841. Bugbot is set up for automated code reviews on this repo. Configure here.