Package glide.api.models.commands
Class SetOptions.SetOptionsBuilder
- java.lang.Object
-
- glide.api.models.commands.SetOptions.SetOptionsBuilder
-
- Enclosing class:
- SetOptions
public static class SetOptions.SetOptionsBuilder extends java.lang.ObjectBuilder class forSetOptions.Provides methods to set conditions under which a value should be set.
Note: Calling any of these methods will override the existing values of
conditionalSetandcomparisonValue, if they are already set.
-
-
Method Summary
-
-
-
Method Detail
-
conditionalSetOnlyIfExists
public SetOptions.SetOptionsBuilder conditionalSetOnlyIfExists()
Sets the condition toSetOptions.ConditionalSet.ONLY_IF_EXISTSfor setting the value.This method overrides any previously set
conditionalSetandcomparisonValue.- Returns:
- This builder instance
-
conditionalSetOnlyIfNotExist
public SetOptions.SetOptionsBuilder conditionalSetOnlyIfNotExist()
Sets the condition toSetOptions.ConditionalSet.ONLY_IF_DOES_NOT_EXISTfor setting the value.This method overrides any previously set
conditionalSetandcomparisonValue.- Returns:
- This builder instance
-
conditionalSetOnlyIfEqualTo
public SetOptions.SetOptionsBuilder conditionalSetOnlyIfEqualTo(@NonNull @NonNull java.lang.String value)
Sets the condition toSetOptions.ConditionalSet.ONLY_IF_EQUALfor setting the value. The key will be set if the provided comparison value matches the existing value.This method overrides any previously set
conditionalSetandcomparisonValue.- Parameters:
value- the value to compare- Returns:
- this builder instance
- Since:
- Valkey 8.1 and above.
-
conditionalSetOnlyIfEqualTo
public SetOptions.SetOptionsBuilder conditionalSetOnlyIfEqualTo(@NonNull @NonNull GlideString value)
Sets the condition toSetOptions.ConditionalSet.ONLY_IF_EQUALfor setting the value. The key will be set if the provided comparison value matches the existing value.This method overrides any previously set
conditionalSetandcomparisonValue.- Parameters:
value- the value to compare- Returns:
- this builder instance
- Since:
- Valkey 8.1 and above.
-
conditionalSet
public SetOptions.SetOptionsBuilder conditionalSet(SetOptions.ConditionalSet conditionalSet)
IfconditionalSetis not set the value will be set regardless of prior value existence. If value isn't set because of the condition, command will returnnull.- Returns:
this.
-
comparisonValue
public SetOptions.SetOptionsBuilder comparisonValue(GlideString comparisonValue)
Value to compare whenSetOptions.ConditionalSet.ONLY_IF_EQUALis set.- Returns:
this.
-
returnOldValue
public SetOptions.SetOptionsBuilder returnOldValue(boolean returnOldValue)
Set command to return the old string stored atkey, ornullifkeydid not exist. An error is returned andSETaborted if the value stored atkeyis not a string. Equivalent toGETin the Valkey API.- Returns:
this.
-
expiry
public SetOptions.SetOptionsBuilder expiry(SetOptions.Expiry expiry)
If not set, no expiry time will be set for the value.- Returns:
this.
-
build
public SetOptions build()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-