Note about needing explicit synchronization if you want to use the returned items map and its cache at the same time
This commit is contained in:
parent
3ff6a5407e
commit
7d1d6d6ae9
4
cache.go
4
cache.go
@ -936,7 +936,9 @@ func (c *cache) LoadFile(fname string) error {
|
||||
|
||||
// Returns the items in the cache. This may include items that have expired,
|
||||
// but have not yet been cleaned up. If this is significant, the Expiration
|
||||
// fields of the items should be checked.
|
||||
// fields of the items should be checked. Note that explicit synchronization
|
||||
// is needed to use a cache and its corresponding Items() return value at
|
||||
// the same time, as the map is shared.
|
||||
func (c *cache) Items() map[string]*Item {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
|
Loading…
Reference in New Issue
Block a user