Stream
Stream class for managing data in Redis.
Source code in blue/stream.py
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | |
__init__(cid, properties={})
Initialize the Stream with a unique identifier and optional properties.
Source code in blue/stream.py
455 456 457 458 459 460 461 462 | |
append_data(key, value)
Append data to a specific key in the stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
The key to append to. |
required | |
value
|
The value to append. |
required |
Source code in blue/stream.py
563 564 565 566 567 568 569 570 571 572 573 574 575 | |
get_all_data()
Get all data for the stream.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing all data in the stream. |
Source code in blue/stream.py
550 551 552 553 554 555 556 557 558 559 560 561 | |
get_data(key)
Get the data for a specific key in the stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
The key to get. |
required |
Returns:
| Type | Description |
|---|---|
|
The value associated with the key, or None if the key does not exist. |
Source code in blue/stream.py
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | |
get_data_len(key)
Get the length of the data array for a specific key in the stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
The key to get the length for. |
required |
Returns: (int): The length of the data array, or 0 if the key does not exist.
Source code in blue/stream.py
577 578 579 580 581 582 583 584 585 586 587 588 589 | |
get_metadata(key='')
Get the metadata for a specific key in the stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
The key to get. |
''
|
Returns: The value associated with the key, or None if the key does not exist.
Source code in blue/stream.py
616 617 618 619 620 621 622 623 624 625 626 627 628 629 | |
set_data(key, value)
Set the data for a specific key in the stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
The key to set. |
required | |
value
|
The value to set. |
required |
Source code in blue/stream.py
520 521 522 523 524 525 526 527 528 529 530 531 532 | |
set_metadata(key, value, nx=False)
Set the metadata for a specific key in the stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
The key to set. |
required | |
value
|
The value to set. |
required | |
nx
|
bool
|
If True, set the value only if it does not already exist. |
False
|
Source code in blue/stream.py
605 606 607 608 609 610 611 612 613 614 | |