Looks like it should be <<= in both cases where e->hits >>= 1 exists.
Let me do some testing. On Wed, Jan 21, 2015 at 5:57 PM, Zhouhaojun <zhouhao...@huawei.com> wrote: > Hi, > > That's exactly what i thought. But even if using ">>=" instead of "<<=", > there still seems to be some inconsistency with the comment ( According to > the implementation of REQUEUE_HITS, the "hits" will be set to 1 if the > number is greater than 1, otherwise it will be set to 0) > > I'm not sure if it is a bug or if the comment is too old...... > > -----邮件原件----- > 发件人: Alan M. Carroll [mailto:a...@network-geographics.com] > 发送时间: 2015年1月22日 8:12 > 收件人: dev@trafficserver.apache.org > 主题: Re: Question about the implementation of CLFUS > > I wonder if it was meant to be "e->hits >>= 1;" - that would almost make > sense with the comment. > > Tuesday, January 20, 2015, 10:00:40 PM, you wrote: > > > Hi all, > > > I have a question about the tick function of RamCacheCLFUS, the code is : > > > ...... > e->>hits <<= 1; > if (e->>hits) { > > e->hits = REQUEUE_HITS(e->hits); > > lru[1].enqueue(e); > > } else > > goto Lfree; > > ...... > > > I'm confused about the code, it doubles the hit number and then check if > the number is zero or not. What's the usage of the doubling ?? > > > It seems the implementation is not the same as the introduction of > history list ( > http://nottheoilrig.com/trafficserver/201408290/arch/cache/ram-cache.en.html), > "Each CLOCK the least recently used entry in the History List is dequeued > and if the "hits" field is not greater than 1 (it was hit at least once in > the History or Cached List) it is deleted, otherwise the "hits" is set to > zero and it is requeued on the History List." > > > > Am I missing something?? > > > > Regards, > > > Huawei Technologies, China > > Haojun Zhou > > > >