Get a time-to-idle (TTI) {@link ExpiryPolicy} instance for the given {@link Duration}.

@param timeToIdle the TTI duration
@return a TTI expiry
515539
public static ExpiryPolicy<Object, Object> timeToIdleExpiration(Duration timeToIdle) {
    Objects.requireNonNull(timeToIdle, "TTI duration cannot be null");
    if (timeToIdle.isNegative()) {
      throw new IllegalArgumentException("TTI duration cannot be negative");
    }
    return new TimeToIdleExpiryPolicy(timeToIdle);
  }
1222521
@Override
    public long getExpiryStartTime()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getExpiryStartTime");

        // Set the expiry to start from the last time we updated the wait time.
        long startTime = getCurrentMEArrivalTimestamp();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "getExpiryStartTime", Long.valueOf(startTime));

        return startTime;
    }
721409
public com.google.protobuf.Duration getDefaultCookieExpiration() {
    return defaultCookieExpiration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : defaultCookieExpiration_;
  }
344385
public Map<String, T> getSome(long to, TimeUnit unit)
    throws InterruptedException, ExecutionException {
    Collection<Operation> timedoutOps = new HashSet<Operation>();
    Map<String, T> ret = internalGet(to, unit, timedoutOps);
    if (timedoutOps.size() > 0) {
      timeout = true;
      LoggerFactory.getLogger(getClass()).warn(
          new CheckedOperationTimeoutException("Operation timed out: ",
              timedoutOps).getMessage());
    }
    return ret;

  }
295693
public final Long getExpiresInSeconds() {
    lock.lock();
    try {
      if (expirationTimeMilliseconds == null) {
        return null;
      }
      return (expirationTimeMilliseconds - clock.currentTimeMillis()) / 1000;
    } finally {
      lock.unlock();
    }
  }
58251
public long getTimeout()
  {
    if (tc.isEntryEnabled()) 
      SibTr.entry(tc, "getTimeout");
      
    long timeout = aiValueTick.getOriginalTimeout();
        
    if (tc.isEntryEnabled()) 
      SibTr.exit(tc, "getTimeout", new Long(timeout));
    return timeout;
  }
876442
public long getIssueTime()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getIssueTime");
      
    long issueTime = aiRequestedTick.getIssueTime();
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "getIssueTime", new Long(issueTime));
    return issueTime;
  }
1054110
private static int getTimeout(final Ticket ticket) {
        val ttl = ticket.getExpirationPolicy().getTimeToLive().intValue();
        if (ttl == 0) {
            return 1;
        }
        return ttl;
    }
895676
public boolean isIdleExpire()
  {
    if (! _lifecycle.isActive())
      return true;
    
    long now = currentTimeActual();
    
    long idleExpire = _threadIdleExpireTime.get();
    
    int idleCount = _idleCount.get();

    // if idle queue is full and the expire is set, return and exit
    if (_idleMin < idleCount) {
      long nextIdleExpire = now + _idleTimeout;

      if (_idleMax < idleCount 
          && _idleMin < _idleMax) {
        /*
          && _threadIdleExpireTime.compareAndSet(idleExpire, nextIdleExpire)) {
          */
        _threadIdleExpireTime.compareAndSet(idleExpire, nextIdleExpire);
        
        return true;
      }
      else if (idleExpire < now
               && _threadIdleExpireTime.compareAndSet(idleExpire,
                                                      nextIdleExpire)) {
        return true;
      }
    }
    
    return false;
  }
364915
public final UserManagedCacheBuilder<K, V, T> withExpiry(ExpiryPolicy<? super K, ? super V> expiry) {
    if (expiry == null) {
      throw new NullPointerException("Null expiry");
    }
    UserManagedCacheBuilder<K, V, T> otherBuilder = new UserManagedCacheBuilder<>(this);
    otherBuilder.expiry = expiry;
    return otherBuilder;
  }
548780
public long get(final TimeUnit toUnit)
	{
		if (this.unit == toUnit)
			return period;
		else
			return toUnit.convert(period, this.unit);
	}
527092
public Integer getMaxIdleTime()
   {
      if (childNode.getTextValueForPatternName("max-idle-time") != null && !childNode.getTextValueForPatternName("max-idle-time").equals("null")) {
         return Integer.valueOf(childNode.getTextValueForPatternName("max-idle-time"));
      }
      return null;
   }
793366
public T setDuration(long duration, TimeUnit units) {
    checkNotNull(units);

    this.duration = units.toMillis(duration);

    return getThis();
  }
789808
public XClaimArgs minIdleTime(Duration minIdleTime) {

        LettuceAssert.notNull(minIdleTime, "Min idle time must not be null");

        return minIdleTime(minIdleTime.toMillis());
    }
854959
public final boolean expirableExpire(PersistentTransaction transaction) throws SevereMessageStoreException // 179365.3
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "expirableExpire", "tran=" + transaction); // 179365.3

        boolean allowed = true;
        if (_statistics.getTotalItemCount() > 0)
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "cannot expire a non-empty stream");
            allowed = false;
        }
        else
        {
            allowed = super.expirableExpire(transaction);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "expirableExpire", Boolean.valueOf(allowed));
        return allowed;
    }
758804
public long getDuration( TimeUnit unit ) {
        if (unit == null) throw new IllegalArgumentException();
        return unit.convert(durationInNanos, TimeUnit.NANOSECONDS);
    }
882328
private static Date getExpireAt(final Ticket ticket) {
        val expirationPolicy = ticket.getExpirationPolicy();
        val ttl = ticket instanceof TicketState
            ? expirationPolicy.getTimeToLive((TicketState) ticket)
            : expirationPolicy.getTimeToLive();

        if (ttl < 1) {
            return null;
        }

        return new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(ttl));
    }