test + fix for actual size function

This commit is contained in:
Karl Seguin
2014-11-21 14:59:04 +07:00
parent ff8727e847
commit c810d4feb3
4 changed files with 72 additions and 6 deletions

View File

@@ -149,10 +149,10 @@ func (c *Cache) worker() {
c.gc()
}
case item := <-c.deletables:
atomic.AddInt64(&c.size, -item.size)
if item.element == nil {
item.promotions = -2
} else {
atomic.AddInt64(&c.size, -item.size)
c.list.Remove(item.element)
}
}