Skip to content

Commit

Permalink
Update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Rene Kroon committed May 22, 2021
1 parent fa22f63 commit bf566d3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,13 @@ func (cache *Cache) SetWithTTL(key string, data interface{}, ttl time.Duration)
return nil
}

// Get is a thread-safe way to lookup items
// Every lookup, also touches the item, hence extending it's life
func (cache *Cache) Get(key string) (interface{}, error) {
return cache.GetByLoader(key, nil)
}

// Get is a thread-safe way to lookup items
// Every lookup, also touches the item, hence extending it's life
// GetByLoader can take a per key loader function (ie. to propagate context)
func (cache *Cache) GetByLoader(key string, customLoaderFunction LoaderFunction) (interface{}, error) {
cache.mutex.Lock()
if cache.isShutDown {
Expand Down

0 comments on commit bf566d3

Please sign in to comment.