mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
rank cache update after count
This commit is contained in:
parent
144d64c250
commit
29ccab9624
1 changed files with 8 additions and 6 deletions
14
fragment.go
14
fragment.go
|
|
@ -398,9 +398,10 @@ func (f *Fragment) setBit(bitmapID, profileID uint64) (changed bool, bool error)
|
|||
}
|
||||
|
||||
// Update the cache.
|
||||
if f.bitmap(bitmapID, true).SetBit(profileID) {
|
||||
changed = true
|
||||
}
|
||||
bm := f.bitmap(bitmapID, true)
|
||||
bm.SetBit(profileID)
|
||||
bm.InvalidateCount() //maybe a perf opportunity?
|
||||
f.cache.Add(bitmapID, bm.Count())
|
||||
|
||||
f.stats.Count("setN", 1)
|
||||
|
||||
|
|
@ -442,9 +443,10 @@ func (f *Fragment) clearBit(bitmapID, profileID uint64) (bool, error) {
|
|||
}
|
||||
|
||||
// Update the cache.
|
||||
if f.bitmap(bitmapID, true).ClearBit(profileID) {
|
||||
return true, nil
|
||||
}
|
||||
bm := f.bitmap(bitmapID, true)
|
||||
bm.ClearBit(profileID)
|
||||
bm.InvalidateCount() //maybe a perf opportunity?
|
||||
f.cache.Add(bitmapID, bm.Count())
|
||||
|
||||
f.stats.Count("clearN", 1)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue