Skip to content

Commit

Permalink
tweak touch get for shard
Browse files Browse the repository at this point in the history
  • Loading branch information
phuslu committed Jan 3, 2024
1 parent 2a73afc commit e17dfc6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ func (s *shard[K, V]) TouchGet(hash uint32, key K) (value V, ok bool) {
value = s.list.nodes[index].value
ok = true
} else if now := atomic.LoadUint32(&clock); now < expires {
s.list.nodes[index].expires = now + s.list.nodes[index].ttl
s.list.MoveToFront(index)
s.list.nodes[index].expires = atomic.LoadUint32(&clock) + s.list.nodes[index].ttl
value = s.list.nodes[index].value
ok = true
} else {
Expand Down

0 comments on commit e17dfc6

Please sign in to comment.