196
207
"""Record that key was accessed."""
197
208
# Move 'node' to the front of the queue
198
209
if self._most_recently_used is None:
200
210
self._most_recently_used = node
201
211
self._last_recently_used = node
205
213
elif node is self._most_recently_used:
206
214
# Nothing to do, this node is already at the head of the queue
208
216
elif node is self._last_recently_used:
210
217
self._last_recently_used = node.prev
212
218
# We've taken care of the tail pointer, remove the node, and insert it