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:
Patrick Mylund Nielsen 2013-08-08 15:10:54 -04:00
parent 3ff6a5407e
commit 7d1d6d6ae9
1 changed files with 3 additions and 1 deletions

View File

@ -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()