maer727@sohu.com wrote:
>
> Thanks, Yee pal!
>
> I still have a question, I think the object that has the
> minimal key value (not the maximal value) will be purged out
> from cache. Am I correct?
Yes.
> I do not understand why "The key will grow over time" if the
> algorithm is described as before. Can you give me a simple
> explanation?
The age is the age or baseline of the heap, not the object. This heap
age should grow slowly over time. The implementation does so by
assigning the heap age to the value of the most recently evicted object
(the one with the smallest key). The heap age represents the lower bound
of all key values currently in the heap, or the current baseline of the
policy priority values.
As new objects are inserted into the heap with a key of "heap age +
object priority value set by the policy", the keys of the heap age are
guaranteed to increase over time.
When a object is touched, its key is recalculated, moving it higer up in
the heap because the age has increased since the object was first
inserted into the heap. In doing this effectively all other objects are
moved closer to the bottom of the heap.
When you look at the heap values, the current policy priority value of a
specific object is best viewed as "the objects assigned heap key -
current heap age". So when the heap age increases (due to objects being
evicted to make room for new) the priority of any objects currently in
the heap decreases, until the object is touched and their priority is
recalculated.
Regards
Henrik
Received on Wed May 29 2002 - 16:51:27 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:15:31 MST