Class ReplaceOptions

    • Method Detail

      • expiry

        public ReplaceOptions expiry​(Duration expiry)
        Sets the expiry for the document. By default the document will never expire.

        The duration must be less than 50 years. For expiry further in the future, use expiry(Instant).

        Parameters:
        expiry - the duration after which the document will expire (zero duration means never expire).
        Returns:
        this options class for chaining purposes.
      • expiry

        public ReplaceOptions expiry​(Instant expiry)
        Sets the expiry for the document. By default the document will never expire.
        Parameters:
        expiry - the point in time when the document will expire (epoch second zero means never expire).
        Returns:
        this options class for chaining purposes.
      • preserveExpiry

        @Uncommitted
        public ReplaceOptions preserveExpiry​(boolean preserveExpiry)
        Specifies whether the document's expiry should be preserved. Defaults to false.

        If true, the document's expiry will not be modified. Otherwise the document's expiry is determined by expiry(Duration) or expiry(Instant).

        Requires Couchbase Server 7.0 or later.

        Parameters:
        preserveExpiry - true to preserve expiry, false to set new expiry
        Returns:
        this options class for chaining purposes.
      • transcoder

        public ReplaceOptions transcoder​(Transcoder transcoder)
        Allows to specify a custom transcoder that is used to encode the content of the request.
        Parameters:
        transcoder - the custom transcoder that should be used for encoding.
        Returns:
        the ReplaceOptions to allow method chaining.
      • cas

        public ReplaceOptions cas​(long cas)
        Specifies a CAS value that will be taken into account on the server side for optimistic concurrency.

        The CAS value is an opaque identifier which is associated with a specific state of the document on the server. The CAS value is received on read operations (or after mutations) and can be used during a subsequent mutation to make sure that the document has not been modified in the meantime.

        If document on the server has been modified in the meantime the SDK will raise a CasMismatchException. In this case the caller is expected to re-do the whole "fetch-modify-update" cycle again. Please refer to the SDK documentation for more information on CAS mismatches and subsequent retries.

        Parameters:
        cas - the opaque CAS identifier to use for this operation.
        Returns:
        the ReplaceOptions for chaining purposes.