// removeExpired makes a pass through map and removes expired elements
// returns the number of expired elements removed
544123
func (m *Memory) removeExpired() int {
	removed := 0
	now := m.Clock().Now().UTC()
	for {
		if len(*m.heap) == 0 {
			break
		}
		item := m.heap.PeekEl()
		if now.Before(item.Expires) {
			break
		}
		m.heap.PopEl()
		m.tree.Delete(item)
		m.Debugf("Removed expired %v %v item.", string(item.Key), item.Expires)
		removed++
	}
	if removed > 0 {
		m.Debugf("Removed %v expired items.", removed)
	}
	return removed
}
1282338
func (cache *Cache) ExpiredCount() (count int64) {
	for i := range cache.segments {
		count += atomic.LoadInt64(&cache.segments[i].totalExpired)
	}
	return
}
66351
func (entry *cacheEntry) isExpiredBy(pointInTime time.Time) bool {
	return pointInTime.After(entry.ExpirationTime)
}
509625
func (si *simpleItem) IsExpired(now *time.Time) bool {
	if si.expiration == nil {
		return false
	}
	if now == nil {
		t := si.clock.Now()
		now = &t
	}
	return si.expiration.Before(*now)
}
288001
func RemoveNestedField(obj map[string]interface{}, fields ...string) {
	m := obj
	for _, field := range fields[:len(fields)-1] {
		if x, ok := m[field].(map[string]interface{}); ok {
			m = x
		} else {
			return
		}
	}
	delete(m, fields[len(fields)-1])
}
269755
func (a *Account) IsExpired() bool {
	a.mu.RLock()
	exp := a.expired
	a.mu.RUnlock()
	return exp
}
854003
func (_m *HostExpirationRegistryInterface) IsExpired(_a0 string) (bool, error) {
	ret := _m.Called(_a0)

	var r0 bool
	if rf, ok := ret.Get(0).(func(string) bool); ok {
		r0 = rf(_a0)
	} else {
		r0 = ret.Get(0).(bool)
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string) error); ok {
		r1 = rf(_a0)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
697652
func removeDuplicates(items []legacy.Item) []legacy.Item {
	// Use map to record duplicates as we find them.
	encountered := map[string]bool{}
	result := make([]legacy.Item, 0, len(items))

	// Loop over all items, if it has not been seen before, append to result.
	for _, e := range items {
		_, ok := encountered[e.FullPath]
		if !ok {
			// Record this element as an encountered element.
			encountered[e.FullPath] = true

			// Append to result slice.
			result = append(result, e)
		}
	}

	return result
}
750249
func (tv *TimedValue) IsExpiredAt(when time.Time) bool {
	if tv.Err == nil {
		return !tv.Expiry.IsZero() && when.After(tv.Expiry)
	}
	// NOTE: When a TimedValue stores an error result, then a zero-value for the
	// Expiry imply the value is immediately expired.
	return tv.Expiry.IsZero() || when.After(tv.Expiry)
}
1135839
func (counter Counter) Expired() bool {
	if counter.Expiration == 0 {
		return false
	}
	return time.Now().UnixNano() > counter.Expiration
}
207683
func (m *LocalDatasetShardsManagerInMemory) purgeExpiredEntries() {
	for {
		func() {
			m.Lock()
			cutoverLimit := time.Now().Add(-24 * time.Hour)
			var oldShardNames []string
			for name, tc := range m.name2Channel {
				if tc.lastWriteAt.Before(cutoverLimit) {
					oldShardNames = append(oldShardNames, name)
				}
			}
			for _, name := range oldShardNames {
				m.doDelete(name)
			}
			m.Unlock()
			time.Sleep(1 * time.Hour)
		}()
	}
}
1020206
func (cache *HealthStatusCache) DeleteExpired() {
	cache.mu.Lock()
	defer cache.mu.Unlock()
	for key, item := range cache.data {
		if item.Expired() {
			cache.delete(key)
		}
	}
}
1001838
func (l *Lambda) remove(kind, name string, m map[string]interface{}) {
	l.log(kind, name, m, '-', red)
}
1097435
func expire(addrs []DatabaseAddress, now int64) []DatabaseAddress {
	i := 0
	for i < len(addrs) {
		if addrs[i].Expires < now {
			// This item is expired. Replace it with the last in the list
			// (noop if we are at the last item).
			addrs[i] = addrs[len(addrs)-1]
			// Wipe the last item of the list to release references to
			// strings and stuff.
			addrs[len(addrs)-1] = DatabaseAddress{}
			// Shorten the slice.
			addrs = addrs[:len(addrs)-1]
			continue
		}
		i++
	}
	return addrs
}
765928
func (self *todoApp) Remove(IGNORED int, oldObj s5.Model) {
	model := oldObj.(*todo)
	finder := s5.HtmlIdFromModel("li", model)
	finder.Dom().Remove()
}
537843
func (m *LocalDatasetShardsManager) purgeExpiredEntries() {
	for {
		func() {
			m.Lock()
			cutoverLimit := time.Now().Add(-24 * time.Hour)
			var oldShardNames []string
			for name, ds := range m.name2Store {
				if ds.LastWriteAt().Before(cutoverLimit) && ds.LastReadAt().Before(cutoverLimit) {
					println("purging dataset", name, "last write:", ds.LastWriteAt().String(), "last read:", ds.LastReadAt().String())
					oldShardNames = append(oldShardNames, name)
				}
			}
			for _, name := range oldShardNames {
				m.doDelete(name)
			}
			m.Unlock()
			time.Sleep(1 * time.Hour)
		}()
	}
}
566565
func (self *Collection) IsExpired(record *Record) bool {
	if self.TTL(record) < 0 {
		return true
	} else {
		return false
	}
}