key_cacher.go
func (mkc *memoryKeyCacher) handleOverflow() {
	if mkc.maxCacheSize < len(mkc.entries) {
		var oldestEntryKeyID string
		var latestAddedTime = time.Now()
		for entryKeyID, entry := range mkc.entries {
			if entry.addedAt.Before(latestAddedTime) {
				latestAddedTime = entry.addedAt
				oldestEntryKeyID = entryKeyID
			}
		}
		delete(mkc.entries, oldestEntryKeyID)
	}
}
func (mkc *memoryKeyCacher) handleOverflow() {
	if mkc.maxCacheSize < len(mkc.entries) {
		var oldestEntryKeyID string
		var latestAddedTime = time.Now()
		for entryKeyID, entry := range mkc.entries {
			if entry.addedAt.Before(latestAddedTime) {
				latestAddedTime = entry.addedAt
				oldestEntryKeyID = entryKeyID
			}
		}
		delete(mkc.entries, oldestEntryKeyID)
	}
}
func ( mkc * memoryKeyCacher ) handleOverflow ( ) { if mkc . maxCacheSize < len ( mkc . entries ) { var oldestEntryKeyID string var latestAddedTime = time . Now ( ) for entryKeyID , entry := range mkc . entries { if entry . addedAt . Before ( latestAddedTime ) { latestAddedTime = entry . addedAt oldestEntryKeyID = entryKeyID } } delete ( mkc . entries , oldestEntryKeyID ) } }
// handleOverflow deletes the oldest key from the cache if overflowed
handleOverflow deletes the oldest key from the cache if overflowed