pub trait Remote:
Send
+ Sync
+ 'static {
// Required methods
fn read(
&self,
request: ReadRequest,
context: ReadContext,
) -> BoxFuture<'_, Result<ReadResult, BoxError>>;
fn write(
&self,
request: WriteRequest,
) -> BoxFuture<'_, Result<(), BoxError>>;
fn invalidate(
&self,
request: InvalidateRequest,
) -> BoxFuture<'_, Result<(), BoxError>>;
}Expand description
Caller-owned semantic Redis boundary.
The cache borrows the adapter and never connects, drains or closes it.
Tracked reads must observe the value and watermark atomically from an
authoritative primary. Writes are one native SET of a complete frame
stamped by the cache; they never create or extend watermarks.
Invalidation runs the shared Lua transition. Use
crate::protocol::decode_frame and crate::protocol::encode_frame
for the wire format.
Required Methods§
Sourcefn read(
&self,
request: ReadRequest,
context: ReadContext,
) -> BoxFuture<'_, Result<ReadResult, BoxError>>
fn read( &self, request: ReadRequest, context: ReadContext, ) -> BoxFuture<'_, Result<ReadResult, BoxError>>
Read one value, and for tracked requests its watermark atomically from
a primary, then classify the result. An Err counts as a cache_read
error and the call falls through to the source.
Sourcefn write(&self, request: WriteRequest) -> BoxFuture<'_, Result<(), BoxError>>
fn write(&self, request: WriteRequest) -> BoxFuture<'_, Result<(), BoxError>>
Store the complete frame under value_key with ttl_ms retention as
one native SET ... PX, without touching watermarks.
Sourcefn invalidate(
&self,
request: InvalidateRequest,
) -> BoxFuture<'_, Result<(), BoxError>>
fn invalidate( &self, request: InvalidateRequest, ) -> BoxFuture<'_, Result<(), BoxError>>
Advance the entity watermark to at least
invalidated_at_ms + future_buffer_ms, only ever widening its retention.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".