Skip to content

Commit

Permalink
Merge pull request #4 from MichaelMure/safe-range
Browse files Browse the repository at this point in the history
Remove comment about unsafe Range() and Reverse()
  • Loading branch information
tidwall committed May 11, 2023
2 parents ee34d3a + 448c9a0 commit 2cd2a20
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lru.go
Expand Up @@ -175,7 +175,6 @@ func (lru *LRU) Delete(key interface{}) (prev interface{}, deleted bool) {

// Range iterates over all key/values in the order of most recently to
// least recently used items.
// It's not safe to call other LRU operations while ranging.
func (lru *LRU) Range(iter func(key interface{}, value interface{}) bool) {
lru.mu.RLock()
defer lru.mu.RUnlock()
Expand All @@ -192,7 +191,6 @@ func (lru *LRU) Range(iter func(key interface{}, value interface{}) bool) {

// Reverse iterates over all key/values in the order of least recently to
// most recently used items.
// It's not safe to call other LRU operations while ranging.
func (lru *LRU) Reverse(iter func(key interface{}, value interface{}) bool) {
lru.mu.RLock()
defer lru.mu.RUnlock()
Expand Down

0 comments on commit 2cd2a20

Please sign in to comment.