glide_shared.commands.stream
StreamTrimOptions
Bases: ABC
Abstract base class for stream trim options.
Attributes:
| Name | Type | Description |
|---|---|---|
exact |
bool
|
If |
threshold |
Union[TEncodable, int]
|
Threshold for trimming. |
method |
str
|
Method for trimming (e.g., MINID, MAXLEN). |
limit |
Optional[int]
|
Max number of entries to be trimmed. Defaults to None.
Note: If |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
to_args()
Convert options to arguments for the command.
Returns:
| Type | Description |
|---|---|
List[TEncodable]
|
List[TEncodable]: List of arguments for the command. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
TrimByMinId
Bases: StreamTrimOptions
Stream trim option to trim by minimum ID.
Attributes:
| Name | Type | Description |
|---|---|---|
exact |
bool
|
If |
threshold |
TEncodable
|
Threshold for trimming by minimum ID. |
limit |
Optional[int]
|
Max number of entries to be trimmed. Defaults to None.
Note: If |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
TrimByMaxLen
Bases: StreamTrimOptions
Stream trim option to trim by maximum length.
Attributes:
| Name | Type | Description |
|---|---|---|
exact |
bool
|
If |
threshold |
int
|
Threshold for trimming by maximum length. |
limit |
Optional[int]
|
Max number of entries to be trimmed. Defaults to None.
Note: If |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
StreamAddOptions
Options for adding entries to a stream.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
Optional[TEncodable]
|
ID for the new entry. If set, the new entry will be added with this ID. If not specified, '*' is used. |
make_stream |
bool
|
If set to False, a new stream won't be created if no stream matches the given key. |
trim |
Optional[StreamTrimOptions]
|
If set, the add operation will also trim the older entries in the stream.
See |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
to_args()
Convert options to arguments for the command.
Returns:
| Type | Description |
|---|---|
List[TEncodable]
|
List[str]: List of arguments for the command. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
StreamRangeBound
Bases: ABC
Abstract Base Class used in the XPENDING, XRANGE, and XREVRANGE commands to specify the starting and ending
range bound for the stream search by stream entry ID.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
148 149 150 151 152 153 154 155 156 157 158 159 | |
to_arg()
abstractmethod
Returns the stream range bound as a string argument to be used in the XRANGE or XREVRANGE commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
154 155 156 157 158 159 | |
MinId
Bases: StreamRangeBound
Stream ID boundary used to specify the minimum stream entry ID. Can be used in the XRANGE or XREVRANGE commands
to get the first stream ID.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
162 163 164 165 166 167 168 169 170 171 | |
MaxId
Bases: StreamRangeBound
Stream ID boundary used to specify the maximum stream entry ID. Can be used in the XRANGE or XREVRANGE commands
to get the last stream ID.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
174 175 176 177 178 179 180 181 182 183 | |
IdBound
Bases: StreamRangeBound
Inclusive (closed) stream ID boundary used to specify a range of IDs to search. Stream ID bounds can be complete with a timestamp and sequence number separated by a dash ("-"), for example "1526985054069-0". Stream ID bounds can also be incomplete, with just a timestamp.
Attributes:
| Name | Type | Description |
|---|---|---|
stream_id |
str
|
The stream ID. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
from_timestamp(timestamp)
staticmethod
Creates an incomplete stream ID boundary without the sequence number for a range search.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timestamp
|
int
|
The stream ID timestamp. |
required |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
196 197 198 199 200 201 202 203 204 | |
ExclusiveIdBound
Bases: StreamRangeBound
Exclusive (open) stream ID boundary used to specify a range of IDs to search. Stream ID bounds can be complete with a timestamp and sequence number separated by a dash ("-"), for example "1526985054069-0". Stream ID bounds can also be incomplete, with just a timestamp.
Attributes:
| Name | Type | Description |
|---|---|---|
stream_id |
TEncodable
|
The stream ID. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
from_timestamp(timestamp)
staticmethod
Creates an incomplete stream ID boundary without the sequence number for a range search.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timestamp
|
int
|
The stream ID timestamp. |
required |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
228 229 230 231 232 233 234 235 236 | |
StreamReadOptions
Options for reading entries from streams. Can be used as an optional argument to XREAD.
Attributes:
| Name | Type | Description |
|---|---|---|
block_ms |
Optional[int]
|
If provided, the request will be blocked for the set amount of milliseconds or
until the server has the required number of entries. Equivalent to |
count |
Optional[int]
|
The maximum number of elements requested. Equivalent to |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
to_args()
Returns the options as a list of string arguments to be used in the XREAD command.
Returns:
| Type | Description |
|---|---|
List[TEncodable]
|
List[TEncodable]: The options as a list of arguments for the |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
StreamGroupOptions
Options for creating stream consumer groups. Can be used as an optional argument to XGROUP CREATE.
Attributes:
| Name | Type | Description |
|---|---|---|
make_stream |
bool
|
If set to True and the stream doesn't exist, this creates a new stream with a length of 0. |
entries_read |
(Optional[int]): A value representing the number of stream entries already read by the group. This option can only be specified if you are using Valkey version 7.0.0 or above. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
to_args()
Returns the options as a list of string arguments to be used in the XGROUP CREATE command.
Returns:
| Type | Description |
|---|---|
List[TEncodable]
|
List[TEncodable]: The options as a list of arguments for the |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
StreamReadGroupOptions
Bases: StreamReadOptions
Options for reading entries from streams using a consumer group. Can be used as an optional argument to
XREADGROUP.
Attributes:
| Name | Type | Description |
|---|---|---|
no_ack |
bool
|
If set, messages are not added to the Pending Entries List (PEL). This is equivalent to
acknowledging the message when it is read. Equivalent to |
block_ms |
Optional[int]
|
If provided, the request will be blocked for the set amount of milliseconds or
until the server has the required number of entries. Equivalent to |
count |
Optional[int]
|
The maximum number of elements requested. Equivalent to |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | |
to_args()
Returns the options as a list of string arguments to be used in the XREADGROUP command.
Returns:
| Type | Description |
|---|---|
List[TEncodable]
|
List[TEncodable]: The options as a list of arguments for the |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
342 343 344 345 346 347 348 349 350 351 352 353 | |
StreamPendingOptions
Options for XPENDING that can be used to filter returned items by minimum idle time and consumer name.
Attributes:
| Name | Type | Description |
|---|---|---|
min_idle_time_ms |
Optional[int]
|
Filters pending entries by their minimum idle time in milliseconds. This option can only be specified if you are using Valkey version 6.2.0 or above. |
consumer_name |
Optional[TEncodable]
|
Filters pending entries by consumer name. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | |
StreamClaimOptions
Options for XCLAIM.
Attributes:
| Name | Type | Description |
|---|---|---|
idle |
Optional[int]
|
Set the idle time (last time it was delivered) of the message in milliseconds. If idle
is not specified, an idle of |
idle_unix_time |
Optional[int]
|
This is the same as idle but instead of a relative amount of milliseconds,
it sets the idle time to a specific Unix time (in milliseconds). This is useful in order to rewrite the AOF
file generating |
retry_count |
Optional[int]
|
Set the retry counter to the specified value. This counter is incremented every
time a message is delivered again. Normally |
is_force |
Optional[bool]
|
Creates the pending message entry in the PEL even if certain specified IDs are not already in the PEL assigned to a different client. However, the message must exist in the stream, otherwise the IDs of non-existing messages are ignored. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | |
to_args()
Converts options for XCLAIM into a List.
Returns:
| Type | Description |
|---|---|
List[TEncodable]
|
List[str]: The options as a list of arguments for the |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | |