// ExpireStorageAfter implements authentication.ExpirableStorageBakeryService.
185249
func (s *ExpirableStorageBakeryService) ExpireStorageAfter(t time.Duration) (authentication.ExpirableStorageBakeryService, error) {
	store := s.Store.ExpireAfter(t)
	service, err := bakery.NewService(bakery.NewServiceParams{
		Location: s.Location(),
		Store:    store,
		Key:      s.Key,
		Locator:  s.Locator,
	})
	if err != nil {
		return nil, errors.Trace(err)
	}
	return &ExpirableStorageBakeryService{service, s.Key, store, s.Locator}, nil
}
1262345
func (v *vaultClient) extendExpiration(ttlSeconds int) {
	v.currentExpirationLock.Lock()
	v.currentExpiration = time.Now().Add(time.Duration(ttlSeconds) * time.Second)
	v.currentExpirationLock.Unlock()
}
746605
func (c *Client) Expire(key string, seconds uint64) (bool, error) {
	var ret bool
	err := c.command(
		&ret,
		[]byte("EXPIRE"),
		[]byte(key),
		to.Bytes(seconds),
	)
	return ret, err
}
203707
func (p *ecrExpirationPolicy) IsExpired(entry *cache.TimestampedEntry) bool {
	return time.Now().After(entry.Obj.(*cacheEntry).expiresAt)
}
483353
func (db *Database) OnUpdateExpiration(sid string, newExpires time.Duration) error {
	expirationTime := time.Now().Add(newExpires)
	timeBytes, err := sessions.DefaultTranscoder.Marshal(expirationTime)
	if err != nil {
		return err
	}

	return db.Service.Update(func(tx *bolt.Tx) error {
		expirationName := getExpirationBucketName([]byte(sid))
		root := db.getBucket(tx)
		b := root.Bucket(expirationName)
		if b == nil {
			// golog.Debugf("tried to reset the expiration value for '%s' while its configured lifetime is unlimited or the session is already expired and not found now", sid)
			return sessions.ErrNotFound
		}

		return b.Put(expirationKey, timeBytes)
	})
}
1228227
func (store *store) expireLeaseOps(name string) ([]txn.Op, error) {

	// We can't expire a lease that doesn't exist.
	lastEntry, found := store.entries[name]
	if !found {
		return nil, lease.ErrInvalid
	}

	// We also can't expire a lease whose expiry time may be in the future.
	latestExpiry := lastEntry.start.Add(lastEntry.duration)
	if !store.globalTime.After(latestExpiry) {
		globalTime, err := store.refreshGlobalTime()
		if err != nil {
			return nil, errors.Annotate(err, "refreshing global time")
		}
		if !globalTime.After(latestExpiry) {
			return nil, errors.Annotatef(lease.ErrInvalid, "lease %q expires in the future", name)
		}
	}

	// The database change is simple, and depends on the lease doc being
	// untouched since we looked:
	expireLeaseOp := txn.Op{
		C:  store.config.Collection,
		Id: store.leaseDocId(name),
		Assert: bson.M{
			fieldHolder:   lastEntry.holder,
			fieldStart:    toInt64(lastEntry.start),
			fieldDuration: lastEntry.duration,
			fieldWriter:   lastEntry.writer,
		},
		Remove: true,
	}

	ops := []txn.Op{expireLeaseOp}
	return ops, nil
}
105885
func Expiry(expiry time.Duration) func(*Invoice) {
	return func(i *Invoice) {
		i.expiry = &expiry
	}
}
613539
func prepareExpiryEntries(committingBlk uint64, dataEntries []*dataEntry, missingDataEntries map[missingDataKey]*bitset.BitSet,
	btlPolicy pvtdatapolicy.BTLPolicy) ([]*expiryEntry, error) {

	var expiryEntries []*expiryEntry
	mapByExpiringBlk := make(map[uint64]*ExpiryData)

	// 1. prepare expiryData for non-missing data
	for _, dataEntry := range dataEntries {
		prepareExpiryEntriesForPresentData(mapByExpiringBlk, dataEntry.key, btlPolicy)
	}

	// 2. prepare expiryData for missing data
	for missingDataKey := range missingDataEntries {
		prepareExpiryEntriesForMissingData(mapByExpiringBlk, &missingDataKey, btlPolicy)
	}

	for expiryBlk, expiryData := range mapByExpiringBlk {
		expiryKey := &expiryKey{expiringBlk: expiryBlk, committingBlk: committingBlk}
		expiryEntries = append(expiryEntries, &expiryEntry{key: expiryKey, value: expiryData})
	}

	return expiryEntries, nil
}
1180097
func (t *TombstoneGC) nextExpires() time.Time {
	// The Round(0) call here is to shed the monotonic time so that we
	// can safely use these as map keys. See #3670 for more details.
	expires := time.Now().Add(t.ttl).Round(0)
	remain := expires.UnixNano() % int64(t.granularity)
	adj := expires.Add(t.granularity - time.Duration(remain))
	return adj
}
604712
func (s *AuthPreferenceV2) SetExpiry(expires time.Time) {
	s.Metadata.SetExpiry(expires)
}
152568
func (r *GithubAuthRequest) Expiry() time.Time {
	if r.Expires == nil {
		return time.Time{}
	}
	return *r.Expires
}
594445
func (s *ServerV2) SetExpiry(expires time.Time) {
	s.Metadata.SetExpiry(expires)
}
1298962
func (s *ADMMessage) SetExpiresAfter(v string) *ADMMessage {
	s.ExpiresAfter = &v
	return s
}
666526
func (f *Facade) SetHostExpiration(ctx datastore.Context, hostid string, expiration int64) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.SetHostExpiration"))
	f.hostRegistry.Set(hostid, expiration)
}
841889
func (u *UserV2) Expiry() time.Time {
	if u.Metadata.Expires != nil && !u.Metadata.Expires.IsZero() {
		return *u.Metadata.Expires
	}
	return u.Spec.Expires
}
1022079
func (r *RedisStorer) ResetExpiry(key string) error {
	return r.client.Expire(key, r.maxAge).Err()
}
1333996
func (o *OIDCConnectorV2) SetExpiry(expires time.Time) {
	o.Metadata.SetExpiry(expires)
}