Permalink
Browse files

Note about needing explicit synchronization if you want to use the re…

…turned items map and its cache at the same time
  • Loading branch information...
1 parent 3ff6a54 commit 7d1d6d6ae935664bc8b80ab2b1fc7ab77a7e46da @patrickmn committed Aug 8, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 cache.go
View
@@ -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()

0 comments on commit 7d1d6d6

Please sign in to comment.