Struct embedded_redis::commands::set::SetCommand
source · pub struct SetCommand<R> { /* private fields */ }Implementations§
source§impl SetCommand<ConfirmationResponse>
impl SetCommand<ConfirmationResponse>
pub fn new<K, V>(key: K, value: V) -> Selfwhere Bytes: From<K> + From<V>,
sourcepub fn expires(
self,
policy: ExpirationPolicy
) -> SetCommand<ConfirmationResponse>
pub fn expires( self, policy: ExpirationPolicy ) -> SetCommand<ConfirmationResponse>
Set expiration (TTL)
sourcepub fn set_exclusive(
self,
option: Exclusivity
) -> SetCommand<ExclusiveSetResponse>
pub fn set_exclusive( self, option: Exclusivity ) -> SetCommand<ExclusiveSetResponse>
Only set key if Exclusivity condition is met
source§impl<R> SetCommand<R>
impl<R> SetCommand<R>
sourcepub fn return_previous(self) -> SetCommand<ReturnPreviousResponse>
pub fn return_previous(self) -> SetCommand<ReturnPreviousResponse>
Returns the previous key by setting the GET option
Trait Implementations§
source§impl<F> Command<F> for SetCommand<ConfirmationResponse>where
F: From<CommandBuilder> + ToStringOption,
impl<F> Command<F> for SetCommand<ConfirmationResponse>where F: From<CommandBuilder> + ToStringOption,
§type Response = ()
type Response = ()
Response type, either a custom evaluated “high-level” response or the original RESP frame
source§fn eval_response(&self, frame: F) -> Result<Self::Response, ResponseTypeError>
fn eval_response(&self, frame: F) -> Result<Self::Response, ResponseTypeError>
The command has the ability to evaluate the response frame and craft its own high level
response from that.
Its also possible to just return 1:1 the RESP2 frame. Read more
source§impl<F> Command<F> for SetCommand<ExclusiveSetResponse>where
F: From<CommandBuilder> + ToStringOption + IsNullFrame,
impl<F> Command<F> for SetCommand<ExclusiveSetResponse>where F: From<CommandBuilder> + ToStringOption + IsNullFrame,
§type Response = Option<()>
type Response = Option<()>
Response type, either a custom evaluated “high-level” response or the original RESP frame
source§fn eval_response(&self, frame: F) -> Result<Self::Response, ResponseTypeError>
fn eval_response(&self, frame: F) -> Result<Self::Response, ResponseTypeError>
The command has the ability to evaluate the response frame and craft its own high level
response from that.
Its also possible to just return 1:1 the RESP2 frame. Read more
source§impl<F> Command<F> for SetCommand<ReturnPreviousResponse>where
F: From<CommandBuilder> + IsNullFrame + ToStringBytes,
impl<F> Command<F> for SetCommand<ReturnPreviousResponse>where F: From<CommandBuilder> + IsNullFrame + ToStringBytes,
§type Response = Option<Bytes>
type Response = Option<Bytes>
Response type, either a custom evaluated “high-level” response or the original RESP frame
source§fn eval_response(&self, frame: F) -> Result<Self::Response, ResponseTypeError>
fn eval_response(&self, frame: F) -> Result<Self::Response, ResponseTypeError>
The command has the ability to evaluate the response frame and craft its own high level
response from that.
Its also possible to just return 1:1 the RESP2 frame. Read more