@param int $ttl

@return int
322592
private function determineTTL($ttl)
    {
        // if no max is set, use the user provided value
        if (!$this->maximumTTL) {
            return $ttl;
        }

        // if the provided ttl is over the maximum ttl, use the max.
        if ($this->maximumTTL < $ttl) {
            return $this->maximumTTL;
        }

        // If no ttl is set, use the max
        if ($ttl == 0) {
            return $this->maximumTTL;
        }

        return $ttl;
    }
906591
public function set($key, $value, $ttl = 2592000)
    {
        if (!self::$instance) {
            self::getInstance();
        }

        return self::$redis->set(CFG_DOMAIN . $key, $value, $ttl);
    }
777083
public function save($data, $ttl = null)
    {
        if (empty($this->stack)) {
            throw new CacheException("Cache::load() must be called before Cache::save()");
        }
        $id = array_pop($this->stack);
        return $this->add($id, $data, $ttl);
    }
1207455
public function set($key, $value, $ttl = 2592000)
    {
        if (!self::$instance) {
            self::getInstance();
        }

        $res = NULL;
        // Try to update existing
        if ($this->exists($key)) {
            $res = self::$memcached->set(CFG_DOMAIN . $key, $value, $ttl);
        } else {
            // Set new
            $res = $this->add($key, $value, $ttl);
        }
        return $res;
    }
822292
function session_lifespan( $ttl = null, $hibernate = null ){
		$current = $this->sess_ttl;
		if( $ttl !== null ){
			$this->sess_ttl = $ttl;
		}
		if( $hibernate !== null ){
			$this->sess_hibernate = $hibernate;
		}
		return $current;
	}
265101
private function count_attempts( $ttl = 300 ) {

		if ( isset( $this->attempts ) ) {
			return;
		}

		$this->sniff_ip();
		$ip = $this->ip_data[ 0 ];

		$attempts = get_site_transient( self::TRANSIENT_NAME );
		is_array( $attempts ) or $attempts = [];

		// Seems the first time a failed attempt for this IP
		if ( ! $attempts || ! array_key_exists( $ip, $attempts ) ) {
			$attempts[ $ip ] = [ 'count' => 0, 'last_logged' => 0, ];
		}

		$attempts[ $ip ][ 'count' ] ++;
		$this->attempts_data = $attempts;

		$count       = $attempts[ $ip ][ 'count' ];
		$last_logged = $attempts[ $ip ][ 'last_logged' ];

		/**
		 * During a brute force attack, logging all the failed attempts can be so expensive to put the server down.
		 * So we log:
		 *
		 * - 3rd attempt
		 * - every 20 when total attempts are > 23 && < 100 (23rd, 43rd...)
		 * - every 100 when total attempts are > 182 && < 1182 (183rd, 283rd...)
		 * - every 200 when total attempts are > 1182 (1183rd, 1383rd...)
		 */
		$do_log =
			$count === 3
			|| ( $count < 100 && ( $count - $last_logged ) === 20 )
			|| ( $count < 1000 && ( $count - $last_logged ) === 100 )
			|| ( ( $count - $last_logged ) === 200 );

		$do_log and $attempts[ $ip ][ 'last_logged' ] = $count;
		set_site_transient( self::TRANSIENT_NAME, $attempts, $ttl );

		$this->attempts = $do_log ? $count : 0;
	}
466288
public function update($value, $ttl = null)
    {
        $queryKeys = $this->prepareKeys(false);

        if (count($queryKeys)) {
            return $this->updateBatchProxy($queryKeys, $value, $ttl);
        }

        return false;
    }
217365
public function setTtl(int $ttl = 86400) : CNabuDataObject
    {
        if ($ttl === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$ttl")
            );
        }
        $this->setValue('nb_domain_zone_ttl', $ttl);
        
        return $this;
    }
546019
async function calculateTtl (ttl = 0, relative = true) {
  if (ttl === 0) return 0
  if (ttl < 0) throw new Error('ttl must be greater than 0')

  if (relative) {
    const { height } = await this.api.getCurrentKeyBlock()
    return +(height) + ttl
  }
  return ttl
}
223599
protected function ttlToMemcachedTime($ttl)
    {
        $seconds = $this->ttlToSeconds($ttl);

        if ($seconds <= 0) {
            return isset($seconds) ? false : 0;
        }

        /* 2592000 seconds = 30 days */
        return $seconds <= 2592000 ? $seconds : $this->ttlToTimestamp($ttl);
    }
55382
public function setTtl($ttl)
    {
        if (!is_null($ttl)) {
            if (!is_numeric($ttl) || (intval($ttl) < 1)) {
                throw new \InvalidArgumentException(sprintf('Invalid TTL: %s', $ttl));
            }

            $this->ttl = intval($ttl);
        } else {
            $this->ttl = null;
        }

        return $this;
    }
856852
public function set($key, $value, $ttl = null)
    {
        return $this->driver->set($key, serialize($value), $ttl);
    }
1002670
public function setCache($adapter, $ttl = 3600)
    {
        $adapter->setOption('ttl', $ttl);
        $this->cache = new Cache($adapter);

        return $this;
    }
581069
public function setMultiple($value_pair, $ttl = null)
    {
        $this->throwInvalidArrayArgumentException($value_pair);

        foreach($value_pair as $key => $value) {
            $this->set($key, $value, $ttl);
        }

        return true;
    }
937966
public function setMultiple($values, $ttl = null)
    {
        return coollect($values)->map(function ($value, $key) use ($ttl) {
            return $this->set($key, $value, $ttl);
        });
    }
610420
public function checkTtlNeedsChanged($ttl)
    {
        $app_version = explode('.', app()->version());

        if (((int) $app_version[0] == 5 && (int) $app_version[1] >= 8) || $app_version[0] > 5) {
            return config('larecipe.cache.period') * 60;
        }

        return $ttl;
    }
1157748
public static function normalizeTtl($ttl)
    {
        self::checkTtlType($ttl);

        if (is_int($ttl)) {
            return $ttl;
        }

        if ($ttl instanceof DateInterval) {
            $now = new DateTimeImmutable;
            return $now->add($ttl)->getTimestamp() - $now->getTimestamp();
        }

        return null;
    }