I have a registry section for my content history.
Each content item is stored with its ContentId as the key and a Json string used for the value. The Json string value is obtained by Json-encoding an associative array containing all the content item's properties I'm interested in saving, including the last-used timestamp, playback position, status, etc.
I define a "desired" maximum number of content items I can store in the history section. In the channel's startup code, I go through the registry deleting any items in excess of the desired maximum, the least-recently accessed items first. It is conceivably possible during any given run of the channel to fill up the registry, but highly unlikely given the size of the registry, the size of each key/value and the number of new content items likely to be accessed during a single run of the channel. This method is mainly designed to prevent the registry history growing over time past its limit.
To delete any excess keys when the channel is run, I calculate the number of excess keys I need to delete, [MAX - GetKeyList().Count()], create an "overflow" array of that size, then read each key in turn [For Each key In GetKeyList()]. For each key, if there's room in the array, I Push {key name, timestamp} into the array. If the array is full, I read each array item to find the one with the newest timestamp; if that timestamp is newer than the current key's timestamp then I replace that item with the current key and its timestamp. At the end of looping through each key in the History section, I loop through my overflow array, Delete() from the registry all the items whose keys I had stored in the array, then Flush() the registry.
It seems to me to be a fairly simple and efficient algorithm. There's no need to apply any complicated sort algorithm to the registry keys to get them sorted in timestamp order, and even though I read every item in the overflow array for each (or most) or the registry keys, the overflow array probably won't have more than a handful of items to read. And there's no special processing needed after the channel has initialized as new keys are added.
The other option would be to check the number of keys in the registry each time a new key is to be added, and if you're already at your limit then delete the oldest key. That would involve reading through each registry key each time a new content item is added to find the oldest one.
Note that in my case I don't actually need a sorted list of most recently-used items. If I did then I'd need additional sorting logic.