// OnUpdateExpiration will re-set the database's session's entry ttl.
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)
	})
}
382413
func (s *Sessions) ShiftExpiration(ctx context.Context) error {
	return s.UpdateExpiration(ctx, s.config.Expires)
}
617867
func (whisper *Whisper) update() {
	// Start a ticker to check for expirations
	expire := time.NewTicker(expirationCycle)

	// Repeat updates until termination is requested
	for {
		select {
		case <-expire.C:
			whisper.expire()

		case <-whisper.quit:
			return
		}
	}
}
498718
func (n *Namespace) SetExpiry(expires time.Time) {
	n.Metadata.SetExpiry(expires)
}
586633
func updateValue(rtx *libredis.Tx, key string, expiration time.Duration) (int64, time.Duration, error) {
	pipe := rtx.Pipeline()
	value := pipe.Incr(key)
	expire := pipe.PTTL(key)

	_, err := pipe.Exec()
	if err != nil {
		return 0, 0, err
	}

	count, err := value.Result()
	if err != nil {
		return 0, 0, err
	}

	ttl, err := expire.Result()
	if err != nil {
		return 0, 0, err
	}

	// If ttl is -1ms, we have to define key expiration.
	// PTTL return values changed as of Redis 2.8
	// Now the command returns -2ms if the key does not exist, and -1ms if the key exists, but there is no expiry set
	// We shouldn't try to set an expiry on a key that doesn't exist
	if ttl == (-1 * time.Millisecond) {
		expire := rtx.Expire(key, expiration)

		ok, err := expire.Result()
		if err != nil {
			return count, ttl, err
		}

		if !ok {
			return count, ttl, errors.New("cannot configure timeout on key")
		}
	}

	return count, ttl, nil

}
337138
func (d *Delay) GetExpiration(key string) time.Time {
	d.lock.RLock()
	expires := d.delay[key]
	d.lock.RUnlock()
	return expires
}
692696
func (s *Invitation) SetExpirationDate(v time.Time) *Invitation {
	s.ExpirationDate = &v
	return s
}
231883
func (a *Account) setExpirationTimer(d time.Duration) {
	a.etmr = time.AfterFunc(d, a.expiredTimeout)
}
653231
func (p *TTLPolicy) IsExpired(obj *TimestampedEntry) bool {
	return p.Ttl > 0 && p.Clock.Since(obj.Timestamp) > p.Ttl
}
526210
func (r *EmptyResource) SetExpiry(expires time.Time) {
	r.Metadata.SetExpiry(expires)
}
261187
func (m *MySQLStore) deleteExpired() error {
	var deleteStmt = "DELETE FROM " + m.table + " WHERE expires_on < NOW()"
	_, err := m.db.Exec(deleteStmt)
	return err
}
598466
func SetExpiry(claims jwt.MapClaims, tm time.Time) {
	claims["exp"] = tm.UTC().Unix()
}
1333996
func (o *OIDCConnectorV2) SetExpiry(expires time.Time) {
	o.Metadata.SetExpiry(expires)
}
1180419
func UpdateExpirationFasthttp(ctx *fasthttp.RequestCtx, expires time.Duration) {
	Default.UpdateExpirationFasthttp(ctx, expires)
}
590578
func (s *HeadObjectOutput) SetExpiration(v string) *HeadObjectOutput {
	s.Expiration = &v
	return s
}
1331259
func (s *CopyObjectOutput) SetExpiration(v string) *CopyObjectOutput {
	s.Expiration = &v
	return s
}
1022079
func (r *RedisStorer) ResetExpiry(key string) error {
	return r.client.Expire(key, r.maxAge).Err()
}