// SetTTL sets the TTL of a key.
341606
func (m *Miniredis) SetTTL(k string, ttl time.Duration) {
	m.DB(m.selectedDB).SetTTL(k, ttl)
}
1297971
func TTL(d time.Duration) Option {
	return func(c Cache) error {
		switch oc := c.(type) {
		case *cache:
			oc.ttl = d
			return nil
		default:
			return errors.New(ErrIllegalCache, errorMessages)
		}
	}
}
255766
func (s *IndexService) Ttl(ttl string) *IndexService {
	s.ttl = ttl
	return s
}
723267
func (e *EtcdStore) Set(key string, value []byte, ttl time.Duration) error {
	c, q := context.WithTimeout(context.Background(), e.Timeout)
	defer q()

	o := &client.SetOptions{TTL: ttl}
	return set(e, c, o, key, string(value[:]))
}
302229
func (r *TunnelConnectionV2) SetTTL(clock clockwork.Clock, ttl time.Duration) {
	r.Metadata.SetTTL(clock, ttl)
}
591399
func (lru *TTLRUCache) AddWithTTL(key, val interface{}, ttl time.Duration) {
	lru.AddWithExpire(key, val, time.Now().Add(ttl))
}
330950
func (s *sticky) CacheTTL(taskID string) (time.Duration, error) {
	return s.cacheTTL, nil
}
579950
func (db *DB) ZTTL(key []byte) (int64, error) {
	if err := checkKeySize(key); err != nil {
		return -1, err
	}

	return db.ttl(ZSetType, key)
}
80736
func (s *UpdateTrafficPolicyInstanceInput) SetTTL(v int64) *UpdateTrafficPolicyInstanceInput {
	s.TTL = &v
	return s
}
350210
func (c *LRUCache) AddWithTTL(key Key, value interface{}, TTL time.Duration) bool {
	expireAt := time.Now().UTC().Add(TTL)
	return c.addRecord(&cacheRecord{
		key:      key,
		value:    value,
		expireAt: &expireAt,
	})
}
704736
func (s *OpenIDConnectConfig) SetAuthTTL(v int64) *OpenIDConnectConfig {
	s.AuthTTL = &v
	return s
}
1218687
func (s *LabelCountersForWorkteam) SetTotal(v int64) *LabelCountersForWorkteam {
	s.Total = &v
	return s
}
445627
func (s *Secret) TokenTTL() (time.Duration, error) {
	if s == nil {
		return 0, nil
	}

	if s.Auth != nil && s.Auth.LeaseDuration > 0 {
		return time.Duration(s.Auth.LeaseDuration) * time.Second, nil
	}

	if s.Data == nil || s.Data["ttl"] == nil {
		return 0, nil
	}

	ttl, err := parseutil.ParseDurationSecond(s.Data["ttl"])
	if err != nil {
		return 0, err
	}

	return ttl, nil
}
111752
func (s *CoverageByTime) SetTotal(v *Coverage) *CoverageByTime {
	s.Total = v
	return s
}
177806
func (_ENSRegistry *ENSRegistrySession) Ttl(node [32]byte) (uint64, error) {
	return _ENSRegistry.Contract.Ttl(&_ENSRegistry.CallOpts, node)
}
700747
func (d *Downloader) requestTTL() time.Duration {
	var (
		rtt  = time.Duration(atomic.LoadUint64(&d.rttEstimate))
		conf = float64(atomic.LoadUint64(&d.rttConfidence)) / 1000000.0
	)
	ttl := time.Duration(ttlScaling) * time.Duration(float64(rtt)/conf)
	if ttl > ttlLimit {
		ttl = ttlLimit
	}
	return ttl
}
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
}