A day or two ago I made github.com/nektro/sdrie which is a single file library to make a map object that allows you to set an expiration on the keys.
Internally there is a native map protected with a semaphore that stores the actual data as well as a list that keeps a linked list of the currently active keys.
Currently, in the background, it loops through the list and checks if the associated key in the map is supposed to be dead. However, the ideal situation would be for the list to be in order of expiration, so that the loop only has to check the first one instead of the entire thing.
If you'd like to tackle this, I'd be happy to accept the contribution/help you through it. 💜 If you have any questions, feel free to message me!
Few things to clarify:
line *list.List -> is used only for removing the keys based on its expiration as a storage?
We might use min heap and check if the root is still alive or not and delete it?
A day or two ago I made github.com/nektro/sdrie which is a single file library to make a
map
object that allows you to set an expiration on the keys.Internally there is a native
map
protected with a semaphore that stores the actual data as well as alist
that keeps a linked list of the currently active keys.Currently, in the background, it loops through the list and checks if the associated key in the map is supposed to be dead. However, the ideal situation would be for the list to be in order of expiration, so that the loop only has to check the first one instead of the entire thing.
If you'd like to tackle this, I'd be happy to accept the contribution/help you through it. 💜 If you have any questions, feel free to message me!
Few things to clarify:
line *list.List -> is used only for removing the keys based on its expiration as a storage?
We might use min heap and check if the root is still alive or not and delete it?
Okay, I would like to follow up on this. Follow back for DM