Class CoreExpiry


  • @Internal
    public final class CoreExpiry
    extends Object
    A relative or absolute expiry.

    Exactly one of relative or absolute is non-null, except for the special NONE instance, which has null for both.

    • Field Detail

      • LATEST_VALID_EXPIRY_INSTANT

        public static final Instant LATEST_VALID_EXPIRY_INSTANT
        Latest expiry instant that can be represented in the Memcached binary protocol.

        The server interprets the Memcached protocol's 32-bit expiry field as an unsigned integer. This means the maximum value is 4294967295 seconds, which corresponds to 2106-02-07T06:28:15Z.

      • EARLIEST_VALID_EXPIRY_INSTANT

        public static final Instant EARLIEST_VALID_EXPIRY_INSTANT
        Earliest expiry instant that can be represented in the Memcached binary protocol.

        A negative instant (before the epoch) could be misinterpreted as in the future. An instant within 30 days after the epoch would be misinterpreted as a relative expiry.

        Fortunately, setting a document's expiry this far in the past is almost certainly a programming error, so it's fine for the SDK to throw an exception.

      • NONE

        public static final CoreExpiry NONE
        A "null object" that represents the absence of an expiry.

        Its isNone() method returns true. Its absolute() and relative methods both return null.