// expired returns a collection of keys for leases that have expired.
// Any pinned leases are not included in the return.
8155
func (f *FSM) removeExpired(newTime time.Time) []lease.Key {
	var expired []lease.Key
	for gKey, entries := range f.groups {
		for key, entry := range entries {
			expiry := entry.start.Add(entry.duration)
			if expiry.Before(newTime) && !f.isPinned(key) {
				delete(entries, key)
				expired = append(expired, key)
			}
		}
		if len(entries) == 0 {
			delete(f.groups, gKey)
		}
	}
	return expired
}
456669
func (d *Accessor) GetUnexpiredCertificates() (crs []certdb.CertificateRecord, err error) {
	err = d.checkDB()
	if err != nil {
		return nil, err
	}

	err = d.db.Select(&crs, fmt.Sprintf(d.db.Rebind(selectAllUnexpiredSQL), sqlstruct.Columns(certdb.CertificateRecord{})))
	if err != nil {
		return nil, wrapSQLError(err)
	}

	return crs, nil
}
619513
func (s Share) IsExpired() bool {
	t := time.Time(s.b.ss.Expires)
	return !t.IsZero() && clockNow().After(t)
}
58768
func (cred Credentials) IsExpired() bool {
	if cred.Expiration.IsZero() || cred.Expiration == timeSentinel {
		return false
	}

	return cred.Expiration.Before(time.Now().UTC())
}
619678
func (l lazyLeaseClaimer) WaitUntilExpired(leaseName string, cancel <-chan struct{}) error {
	claimer, err := l.leaseClaimer()
	if err != nil {
		return errors.Trace(err)
	}
	return claimer.WaitUntilExpired(leaseName, cancel)
}
1094529
func (o *pdOracle) IsExpired(lockTS, TTL uint64) bool {
	lastTS := atomic.LoadUint64(&o.lastTS)
	return oracle.ExtractPhysical(lastTS) >= oracle.ExtractPhysical(lockTS)+int64(TTL)
}
408295
func (b *LRUCache) expiredEntry(now time.Time) *entry {
	if len(b.priorityQueue) == 0 {
		return nil
	}

	if now.IsZero() {
		// Fill it only when actually used.
		now = time.Now()
	}

	if e := b.priorityQueue[0]; e.expire.Before(now) {
		return e
	}
	return nil
}
369929
func (c *Credentials) IsExpired() bool {
	c.Lock()
	defer c.Unlock()

	return c.isExpired()
}
35792
func (c Claims) Expiration() (time.Time, bool) {
	return jwt.Claims(c).Expiration()
}
261187
func (m *MySQLStore) deleteExpired() error {
	var deleteStmt = "DELETE FROM " + m.table + " WHERE expires_on < NOW()"
	_, err := m.db.Exec(deleteStmt)
	return err
}
638651
func (l *lockRESTServer) ExpiredHandler(w http.ResponseWriter, r *http.Request) {
	if !l.IsValid(w, r) {
		l.writeErrorResponse(w, errors.New("Invalid request"))
		return
	}

	ctx := newContext(r, w, "Expired")

	var lockArgs dsync.LockArgs
	if r.ContentLength < 0 {
		l.writeErrorResponse(w, errInvalidArgument)
		return
	}

	err := gob.NewDecoder(r.Body).Decode(&lockArgs)
	if err != nil {
		l.writeErrorResponse(w, err)
		return
	}
	success := true
	l.ll.mutex.Lock()
	defer l.ll.mutex.Unlock()
	// Lock found, proceed to verify if belongs to given uid.
	if lri, ok := l.ll.lockMap[lockArgs.Resource]; ok {
		// Check whether uid is still active
		for _, entry := range lri {
			if entry.UID == lockArgs.UID {
				success = false // When uid found, lock is still active so return not expired.
				break
			}
		}
	}
	// When we get here lock is no longer active due to either dsync.LockArgs.Resource
	// being absent from map or uid not found for given dsync.LockArgs.Resource
	resp := lockResponse{Success: success}
	logger.LogIf(ctx, gob.NewEncoder(w).Encode(resp))
	w.(http.Flusher).Flush()
}
1028235
func (p *TTLPolicy) IsExpired(obj *timestampedEntry) bool {
	return p.Ttl > 0 && p.Clock.Since(obj.timestamp) > p.Ttl
}
303686
func snapshotExpired(ts *data.SignedTimestamp, snapshot []byte) bool {
	// If this check failed, it means the current snapshot was not exactly what we expect
	// via the timestamp. So we can consider it to be "expired."
	return data.CheckHashes(snapshot, data.CanonicalSnapshotRole.String(),
		ts.Signed.Meta[data.CanonicalSnapshotRole.String()].Hashes) != nil
}
1135839
func (counter Counter) Expired() bool {
	if counter.Expiration == 0 {
		return false
	}
	return time.Now().UnixNano() > counter.Expiration
}
566565
func (self *Collection) IsExpired(record *Record) bool {
	if self.TTL(record) < 0 {
		return true
	} else {
		return false
	}
}
1108355
func (l Lease) ExpirationTime() (time.Time, error) {
	t, err := time.Parse(TimeFormat, l.LeaseExpirationTime)
	if err != nil {
		return zeroTime, err
	}
	return t, nil
}
1300141
func (s *CacheService) IsExpired(base string) bool {
	// No cache? bail.
	if cache[base] == nil || (len(cache[base].Rates) <= 0) {
		return true
	}

	// Expired cache? bail.
	lastUpdated := cache[base].UpdatedAt
	if lastUpdated != nil && lastUpdated.Add(cacheTTL).Before(time.Now()) {
		return true
	}

	return false
}