A dict from key to node makes every move O(1)
The list makes moving a node O(1), but only once you hold the node. A dict from each key to its node is how you get it in O(1): look up the key, then unlink or move the node.
That pair, a dict pointing into a doubly linked list, is the whole LRU cache. It's also what the checkpoint below builds for sign-in sessions. The LeetCode problem Design Authentication Manager has this shape. One GitHub compilation of OpenAI's LeetCode questions tags it as a doubly linked list question (2 sources).
Every session gets the same ttl, and time only goes forward, so the session started or renewed longest ago always expires first: that one sits right after the head, at head.next. live only has to drop from the front.
In the editor, finish renew and live for Sessions. It starts two sessions, renews the first, and counts the live ones at three times.