I'm looking for a dictionary like object in which each key has a ttl (or countdown) that is decremented each time
.pop() is called. When the counter hits 0
.pop() actually removes it. Something analogous to the Time-to-Live of network packets, which is measured in hops rather than seconds.
I'm guessing something like this exists, but I don't know the name.
>>> d = X(); d.set('k', 'v', ttl=2); d.set('k2', 'v2', ttl=7)
What wheel am I reinventing?