func (c *cache) DeleteExpired() {
	var evictedItems []keyAndValue
	now := time.Now().UnixNano()
	c.mu.Lock()
	for k, v := range c.items {
		// "Inlining" of expired
		if v.Expiration > 0 && now > v.Expiration {
			ov, evicted := c.delete(k)
			if evicted {
				evictedItems = append(evictedItems, keyAndValue{k, ov})
			}
		}
	}
	c.mu.Unlock()
	for _, v := range evictedItems {
		c.onEvicted(v.key, v.value)
	}
}
func (c *cache) DeleteExpired() {
	var evictedItems []keyAndValue
	now := time.Now().UnixNano()
	c.mu.Lock()
	for k, v := range c.items {
		// "Inlining" of expired
		if v.Expiration > 0 && now > v.Expiration {
			ov, evicted := c.delete(k)
			if evicted {
				evictedItems = append(evictedItems, keyAndValue{k, ov})
			}
		}
	}
	c.mu.Unlock()
	for _, v := range evictedItems {
		c.onEvicted(v.key, v.value)
	}
}
func ( c * cache ) DeleteExpired ( ) { var evictedItems [ ] keyAndValue now := time . Now ( ) . UnixNano ( ) c . mu . Lock ( ) for k , v := range c . items { // "Inlining" of expired if v . Expiration > 0 && now > v . Expiration { ov , evicted := c . delete ( k ) if evicted { evictedItems = append ( evictedItems , keyAndValue { k , ov } ) } } } c . mu . Unlock ( ) for _ , v := range evictedItems { c . onEvicted ( v . key , v . value ) } }
// Delete all expired items from the cache.
Delete all expired items from the cache .