Skip to content

Commit

Permalink
[#98] Remove batch processing
Browse files Browse the repository at this point in the history
  • Loading branch information
maypok86 committed Jul 29, 2024
1 parent c4ac892 commit b2a4cbb
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions internal/core/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,29 +443,14 @@ func (c *Cache[K, V]) onWrite(t task[K, V]) {
func (c *Cache[K, V]) process() {
for {
t := c.writeBuffer.Pop()

c.evictionMutex.Lock()
c.onWrite(t)
c.evictionMutex.Unlock()

if t.isClose() {
c.evictionMutex.Unlock()
break
} else if t.isClear() {
c.evictionMutex.Unlock()
continue
}
for i := uint32(0); i < maxWriteBufferSize; i++ {
t, ok := c.writeBuffer.TryPop()
if !ok {
break
}
c.onWrite(t)
if t.isClose() {
c.evictionMutex.Unlock()
return
} else if t.isClear() {
break
}
}
c.evictionMutex.Unlock()
}
}

Expand Down

0 comments on commit b2a4cbb

Please sign in to comment.