On Mon, 20 Apr 2009 14:35:49 +0100 RW <rwmaillists@xxxxxxxxxxxxxx> wrote: > On Sun, 19 Apr 2009 19:03:36 +0100 > Gavin McCullagh <gavin.mccullagh@xxxxxx> wrote: > > > > With a heap, things are more complex. I guess you could give an > > indication of the depth in the heap but there would be so many > > objects on the lowest levels, I don't suppose this would be a great > > guide. Is there some better value available, such as the key used > > in the heap maybe? > > You could probably do this with a modified version of heap LRU, using > a counter rather than a timestamp as a key. You could then work-out > the relative position in the queue, from the key value, the current > counter value, and the key value at the top of the heap. I should add that since heap key values don't persist over a restart, the heap would not initially be in LRU order, so you would have to wait for the normal LRU reference age before any statistics are meaningful -or start with an empty cache.