// expirer runs in a separate goroutine and checks for instance expiration.
341560
func (s *Store) expirer() {
	defer s.wg.Done()

	ticker := time.NewTicker(s.ExpiryCheckInterval)
	defer ticker.Stop()

	for {
		// Wait for next check or for close signal.
		select {
		case <-s.closing:
			return
		case <-ticker.C:
		}

		// Check all instances for expiration.
		if err := s.EnforceExpiry(); err != nil && err != raft.ErrNotLeader {
			s.logger.Printf("enforce expiry: %s", err)
		}
	}
}
165978
func (state *ServicesState) ExpireServer(hostname string) {
	if !state.HasServer(hostname) || len(state.Servers[hostname].Services) == 0 {
		log.Infof("No records to expire for %s", hostname)
		return
	}

	hasLiveServices := false
	for _, svc := range state.Servers[hostname].Services {
		if !svc.IsTombstone() {
			hasLiveServices = true
			break
		}
	}

	if !hasLiveServices {
		log.Infof("No records to expire for %s (no live services)", hostname)
		return
	}

	log.Infof("Expiring %s", hostname)

	var tombstones []service.Service

	for _, svc := range state.Servers[hostname].Services {
		previousStatus := svc.Status
		state.ServiceChanged(svc, previousStatus, svc.Updated)
		svc.Tombstone()
		tombstones = append(tombstones, *svc)
	}

	if len(tombstones) < 1 {
		log.Warn("Tried to announce a zero length list of tombstones")
		return
	}

	state.SendServices(
		tombstones,
		director.NewTimedLooper(TOMBSTONE_COUNT, state.tombstoneRetransmit, nil),
	)
}
682660
func (hc *HealthCheck) Expires() time.Duration {
	tolerance := hc.Tolerance
	if tolerance <= 0 {
		tolerance = DefaultTolerance
	}
	return time.Duration(tolerance) * (hc.GetTimeout() + hc.Interval)
}
1347012
func SetExpiry(expiry time.Duration) Option {
	return OptionFunc(func(m *Mutex) {
		m.expiry = expiry
	})
}
604712
func (s *AuthPreferenceV2) SetExpiry(expires time.Time) {
	s.Metadata.SetExpiry(expires)
}
64053
func (c *ClusterConfigV3) SetExpiry(expires time.Time) {
	c.Metadata.SetExpiry(expires)
}
269755
func (a *Account) IsExpired() bool {
	a.mu.RLock()
	exp := a.expired
	a.mu.RUnlock()
	return exp
}
264605
func (t *TombstoneGC) expireTime(expires time.Time) {
	// This is careful to take the lock only while we are fetching the index
	// since the channel write might get blocked for reasons that could also
	// need to hint GC (see #3700).
	if index := t.purgeBin(expires); index > 0 {
		t.expireCh <- index
	}
}
662605
func (lt *LifeTime) HasExpired() bool {
	if lt.IsZero() {
		return false
	}

	return lt.Time.Before(time.Now())
}
543490
func (b *LRUCache) ExpireNow(now time.Time) int {
	b.lock.Lock()
	defer b.lock.Unlock()

	i := 0
	for {
		e := b.expiredEntry(now)
		if e == nil {
			break
		}
		b.removeEntry(e)
		i += 1
	}
	return i
}
1135839
func (counter Counter) Expired() bool {
	if counter.Expiration == 0 {
		return false
	}
	return time.Now().UnixNano() > counter.Expiration
}
665009
func (db *DB) Expire(key []byte, duration int64) (int64, error) {
	if duration <= 0 {
		return 0, errExpireValue
	}

	return db.setExpireAt(key, time.Now().Unix()+duration)
}
60664
func (h *healthcheckManager) expire() {
	h.lock.RLock()
	ids := h.ids
	h.lock.RUnlock()

	status := healthcheck.Status{State: healthcheck.StateUnknown}
	for _, id := range ids {
		h.queueHealthState(&healthcheck.Notification{id, status})
	}
}
192161
func NewGraduatingExpirationProvider(initialExpiry, increments, maxExpiry time.Duration) ExpirationProvider {
	var iteration uint32
	return func() time.Duration {
		expiry := initialExpiry + time.Duration(iteration)*increments
		if expiry > maxExpiry {
			return maxExpiry
		}
		iteration++
		return expiry
	}
}
607956
func (p *ProcessProvider) IsExpired() bool {
	if p.staticCreds {
		return false
	}
	return p.Expiry.IsExpired()
}
527673
func (c *asyncClient) Expire(arg0 string, arg1 int64) (result FutureBool, err Error) {
	arg0bytes := []byte(arg0)
	arg1bytes := []byte(fmt.Sprintf("%d", arg1))

	var resp *PendingResponse
	resp, err = c.conn.QueueRequest(&EXPIRE, [][]byte{arg0bytes, arg1bytes})
	if err == nil {
		result = resp.future.(FutureBool)
	}
	return result, err

}
885550
func (s *Command) SetExpiresAfter(v time.Time) *Command {
	s.ExpiresAfter = &v
	return s
}