File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
src/frequenz/channels/experimental Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change 1818the cached value for a specific key.
1919
2020Example:
21- ```python
22- from frequenz.channels import Broadcast
23- from frequenz.channels.experimental import GroupingLatestValueCache
21+ ```python
22+ from frequenz.channels import Broadcast
23+ from frequenz.channels.experimental import GroupingLatestValueCache
2424
25- channel = Broadcast[tuple[int, str]](name="lvc_test")
25+ channel = Broadcast[tuple[int, str]](name="lvc_test")
2626
27- cache = GroupingLatestValueCache(channel.new_receiver(), key=lambda x: x[0])
28- sender = channel.new_sender()
27+ cache = GroupingLatestValueCache(channel.new_receiver(), key=lambda x: x[0])
28+ sender = channel.new_sender()
2929
30- assert not cache.has_value(6)
30+ assert not cache.has_value(6)
3131
32- await sender.send((6, "twenty-six"))
32+ await sender.send((6, "twenty-six"))
3333
34- assert cache.has_value(6)
35- assert cache.get(6) == (6, "twenty-six")
36- ```
34+ assert cache.has_value(6)
35+ assert cache.get(6) == (6, "twenty-six")
36+ ```
3737"""
3838
3939
You can’t perform that action at this time.
0 commit comments