// SetExpiration sets the expiration time for the lock delay to the given
// delay from the given now time.
486044
func (d *Delay) SetExpiration(key string, now time.Time, delay time.Duration) {
	d.lock.Lock()
	defer d.lock.Unlock()

	d.delay[key] = now.Add(delay)
	time.AfterFunc(delay, func() {
		d.lock.Lock()
		delete(d.delay, key)
		d.lock.Unlock()
	})
}
296098
func (s *GetObjectOutput) SetExpiration(v string) *GetObjectOutput {
	s.Expiration = &v
	return s
}
1237031
func (s *HeadObjectOutput) SetExpires(v string) *HeadObjectOutput {
	s.Expires = &v
	return s
}
1351397
func (p *ProvisionTokenV2) SetExpiry(expires time.Time) {
	p.Metadata.SetExpiry(expires)
}
252818
func (c *LFUCache) SetWithExpire(key, value interface{}, expiration time.Duration) error {
	c.mu.Lock()
	defer c.mu.Unlock()
	item, err := c.set(key, value)
	if err != nil {
		return err
	}

	t := c.clock.Now().Add(expiration)
	item.(*lfuItem).expiration = &t
	return nil
}
139278
func (c *client) setExpirationTimer(d time.Duration) {
	c.mu.Lock()
	c.atmr = time.AfterFunc(d, c.authExpired)
	c.mu.Unlock()
}
1136508
func (s *ImportKeyMaterialInput) SetExpirationModel(v string) *ImportKeyMaterialInput {
	s.ExpirationModel = &v
	return s
}
973189
func (s *Activation) SetExpirationDate(v time.Time) *Activation {
	s.ExpirationDate = &v
	return s
}
933616
func (s *GetDomainDetailOutput) SetExpirationDate(v time.Time) *GetDomainDetailOutput {
	s.ExpirationDate = &v
	return s
}
526210
func (r *EmptyResource) SetExpiry(expires time.Time) {
	r.Metadata.SetExpiry(expires)
}
463630
func (rkv *KeyValue) SetExpire(key, value string, expire time.Duration) error {
	conn := rkv.pool.Get(rkv.dbindex)
	// Convert from nanoseconds to milliseconds
	expireMilliseconds := expire.Nanoseconds() / 1000000
	// Set the value, together with an expiry time, given in milliseconds
	_, err := conn.Do("SET", rkv.id+":"+key, value, "PX", expireMilliseconds)
	return err
}
839643
func (s *Entitlement) SetExpirationDate(v time.Time) *Entitlement {
	s.ExpirationDate = &v
	return s
}
594445
func (s *ServerV2) SetExpiry(expires time.Time) {
	s.Metadata.SetExpiry(expires)
}
1228770
func (s *InstanceAccessDetails) SetExpiresAt(v time.Time) *InstanceAccessDetails {
	s.ExpiresAt = &v
	return s
}
207571
func (s *CreateImageBuilderStreamingURLOutput) SetExpires(v time.Time) *CreateImageBuilderStreamingURLOutput {
	s.Expires = &v
	return s
}
853386
func (r *Redis) SetExpired(key string, value interface{}, expire time.Duration) {
	// log.DebugWithFields(log.Fields{"key": key, "value": value, "expireTime": expire}, "set to cache")

	var buf bytes.Buffer // Stand-in for a network connection
	if err := gob.NewEncoder(&buf).Encode(value); err != nil {
		panic(err)
	}
	conn := r.GetConn()
	defer conn.Close()

	if int64(expire.Seconds()) > int64(0) {
		_, err := conn.Do("SET", key, buf.Bytes(), "EX", int64(expire.Seconds()))
		errors.Panic(err)
	} else {
		_, err := conn.Do("SET", key, buf.Bytes())
		errors.Panic(err)
	}
}
317146
func (c *RedisCache) SetExpire(key string, data interface{}, ttl int64) error {
	conn, err := c.conn()
	if err != nil {
		return err
	}
	defer conn.Close()

	if data == nil {
		_, err = conn.Do("DEL", c.prefix+key)
		return err
	}

	item := eurekache.NewItem()
	item.SetExpire(ttl)
	item.Value = data

	var buf bytes.Buffer
	enc := gob.NewEncoder(&buf)
	err = enc.Encode(item)
	if err != nil {
		return err
	}

	switch {
	case ttl < 1:
		_, err = conn.Do("SET", c.prefix+key, buf.Bytes())
	default:
		ttl = ttl / 1000 // convert milli-sec to sec
		_, err = conn.Do("SETEX", c.prefix+key, ttl, buf.Bytes())
	}

	if err != nil {
		return err
	}
	return nil
}