func (cch *store) expiredItemReaper() error {
	for {
		select {
		case <-time.After(30 * time.Second):
			// make a list of items that need to be deleted, but avoid
			// fully locking the entries map.
			var del []itemID
			cch.mu.RLock()
			for k, v := range cch.entries {
				if cch.isExpired(v) {
					del = append(del, k)
				}
			}
			cch.mu.RUnlock()
			if len(del) == 0 {
				continue
			}
			// with at least one entry to delete, obtain a full write lock
			// and make the modifications in a loop.
			cch.mu.Lock()
			for _, k := range del {
				delete(cch.entries, k)
			}
			cch.mu.Unlock()
		}
	}
}
// expiredItemReaper deletes expired entries from the store at regular
// intervals.
expiredItemReaper deletes expired entries from the store at regular
intervals.
// expiredItemReaper deletes expired entries from the store at regular // intervals .
func (cch *store) expiredItemReaper() error {
	for {
		select {
		case <-time.After(30 * time.Second):
			var del []itemID
			cch.mu.RLock()
			for k, v := range cch.entries {
				if cch.isExpired(v) {
					del = append(del, k)
				}
			}
			cch.mu.RUnlock()
			if len(del) == 0 {
				continue
			}
			cch.mu.Lock()
			for _, k := range del {
				delete(cch.entries, k)
			}
			cch.mu.Unlock()
		}
	}
}
func ( cch * store ) expiredItemReaper ( ) error { for { select { case <- time . After ( 30 * time . Second ) : var del [ ] itemID cch . mu . RLock ( ) for k , v := range cch . entries { if cch . isExpired ( v ) { del = append ( del , k ) } } cch . mu . RUnlock ( ) if len ( del ) == 0 { continue } cch . mu . Lock ( ) for _ , k := range del { delete ( cch . entries , k ) } cch . mu . Unlock ( ) } } }
expiredItemReaper deletes expired entries from the store at regular
intervals.
expiredItemReaper deletes expired entries from the store at regular intervals .
// make a list of items that need to be deleted, but avoid // fully locking the entries map. // with at least one entry to delete, obtain a full write lock // and make the modifications in a loop.