pub struct Set { /* private fields */ }Expand description
SET key value [EX seconds] [PX milliseconds] [NX|XX] [GET]
Sets key to hold value.
The compatibility response is Option<Bytes>: GET returns the previous
value, while both OK and a null conditional reply become None. Code that
must distinguish an applied write from an unmet NX or XX condition
should finish the builder with Set::with_outcome.
Implementations§
Source§impl Set
impl Set
Sourcepub fn new(key: impl Into<CommandArg>, value: impl Into<CommandArg>) -> Set
pub fn new(key: impl Into<CommandArg>, value: impl Into<CommandArg>) -> Set
Create a new Set command.
Sourcepub fn with_outcome(self) -> SetWithOutcome
pub fn with_outcome(self) -> SetWithOutcome
Return an unambiguous write status and previous-value result.
This additive response mode leaves Set’s original Option<Bytes>
response intact for compatibility. Call it after configuring the
command:
use redis_tower_commands::{Set, SetPreviousValue, SetStatus};
use redis_tower_core::Command;
let command = Set::new("lease", "owner").nx().get().with_outcome();
assert_eq!(command.name(), "SET");
let _ = (SetStatus::Applied, SetPreviousValue::Missing);Trait Implementations§
Source§impl Command for Set
impl Command for Set
Source§fn parse_response(
&self,
frame: Frame,
) -> Result<<Set as Command>::Response, RedisError>
fn parse_response( &self, frame: Frame, ) -> Result<<Set as Command>::Response, RedisError>
Parse a RESP response frame into the typed response. Read more
Source§fn idempotent(&self) -> bool
fn idempotent(&self) -> bool
Whether this command is safe to retry on connection errors. Read more
Source§fn is_blocking(&self) -> bool
fn is_blocking(&self) -> bool
Whether this command blocks the connection until data is available or a
timeout elapses –
BLPOP, BRPOP, BLMOVE, BZPOPMIN/BZPOPMAX, and
XREAD/XREADGROUP with BLOCK. Read moreAuto Trait Implementations§
impl !Freeze for Set
impl RefUnwindSafe for Set
impl Send for Set
impl Sync for Set
impl Unpin for Set
impl UnsafeUnpin for Set
impl UnwindSafe for Set
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<C> RequestDeadline for Cwhere
C: Command,
impl<C> RequestDeadline for Cwhere
C: Command,
Source§fn request_deadline(&self) -> Option<Instant>
fn request_deadline(&self) -> Option<Instant>
Return the request’s absolute deadline, if it carries one.