public static int ttlToExpiration()

in folsom/src/main/java/com/spotify/folsom/client/Utils.java [36:53]


  public static int ttlToExpiration(final int ttl) {
    if (ttl <= 0) {
      return 0;
    }

    if (ttl < TTL_CUTOFF) {
      return ttl;
    }

    int expirationTime = (int) (System.currentTimeMillis() / 1000) + ttl;
    if (expirationTime < 0) {
      // throw new IllegalArgumentException("TTL set too far into the future (Y2038 limitation)");
      // Not strictly correct - should switch to failure on the next major version bump
      return Integer.MAX_VALUE
          - 1; // Avoid Integer.MAX_VALUE in case memcached treats it in some special way.
    }
    return expirationTime;
  }