Skip to content

Commit

Permalink
threads
Browse files Browse the repository at this point in the history
  • Loading branch information
keruch committed Sep 19, 2024
1 parent 0f4d284 commit 897e8ed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils/cache/ordered.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ func (c *InsertionOrdered[K, V]) Get(key K) (zero V, found bool) {
}

// MustGet is Get that panics when the key is not found.
func (c *InsertionOrdered[K, V]) MustGet(key K) (zero V) {
idx, ok := c.keyToIdx[key]
func (c *InsertionOrdered[K, V]) MustGet(key K) V {
value, ok := c.Get(key)
if ok {
return c.idxToValue[idx]
return value
}
panic(fmt.Errorf("internal contract error: key is not found in the cache: %v", key))
}
Expand Down

0 comments on commit 897e8ed

Please sign in to comment.