code: private static @Nullable Long durationInNanos(long duration, @Nullable TimeUnit unit) {
      return (unit == null) ? null : unit.toNanos(duration);
    }
docs: Converts an expiration duration/unit pair into a single Long for hashing and equality. Uses
  nanos to match CacheBuilder implementation.