Class StoreValueIfAbsent

java.lang.Object
io.fluxcapacitor.common.api.Request
io.fluxcapacitor.common.api.Command
io.fluxcapacitor.common.api.keyvalue.StoreValueIfAbsent
All Implemented Interfaces:
JsonType

public class StoreValueIfAbsent extends Command
Stores a key-value pair only if the specified key does not already exist in the key-value store.

This command ensures atomic "put-if-absent" semantics, making it useful for distributed locks, idempotency markers, or one-time setup flags in legacy Flux applications.

Notes

  • Always uses Guarantee.STORED for persistence safety.
  • This command is part of the legacy key-value subsystem. For most modern use cases, consider migrating to the DocumentStore or Searchable storage model.
See Also:
  • Constructor Details

    • StoreValueIfAbsent

      public StoreValueIfAbsent()
  • Method Details

    • getGuarantee

      public Guarantee getGuarantee()
      Description copied from class: Command
      Indicates the delivery guarantee required for this command.
      Specified by:
      getGuarantee in class Command
      Returns:
      the Guarantee level (e.g. STORED, SENT, NONE)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toMetric

      public StoreValueIfAbsent.Metric toMetric()
      Description copied from interface: JsonType
      Converts this object into a compact metric representation for logging or monitoring.

      Used by the Flux client to avoid logging large payloads directly while still tracking platform usage.

      Returns:
      a safe and compact object suitable for serialization to the metrics log
    • routingKey

      public String routingKey()
      Description copied from class: Command
      Optionally specifies a routing key for this command, which may be used to partition work or apply consistent hashing when processed in the Flux platform.
      Overrides:
      routingKey in class Command
      Returns:
      a routing key string, or null if not specified