Ttl counter
TTLCounter
TTLCounter is a counter/list that expires items after a TTL period expires.
Source code in video_sampler/ttl_counter.py
4 5 6 7 8 9 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 |
|
__len__()
Return the number of items in the counter.
Source code in video_sampler/ttl_counter.py
11 12 13 |
|
add_item(hash)
Add an item with the max TTL.
Source code in video_sampler/ttl_counter.py
15 16 17 |
|
expire_all()
Expire all items.
Source code in video_sampler/ttl_counter.py
33 34 35 36 37 |
|
expire_one()
Expire the first item if its TTL is 0. Expires AT MOST one item.
Source code in video_sampler/ttl_counter.py
24 25 26 27 28 29 30 31 |
|
tick()
Decrease the TTL of all items by 1.
Source code in video_sampler/ttl_counter.py
19 20 21 22 |
|