pub struct RedisKv(/* private fields */);Expand description
KeyValue over Redis (one shared ConnectionManager, cloned per
call — a cheap channel copy, not a new connection).
§Differences from the Workers KV binding (documented, not papered
over)
| Workers KV | RedisKv | |
|---|---|---|
| Consistency | eventually consistent; a write can take up to ~60 s to propagate to other colos, and reads may hit a stale per-colo cache | strongly consistent single Redis: a read after a write sees the write |
| Failure mode | KV outages degrade per colo; values survive Redis-down | Redis is a single point of failure and of latency for the port |
| TTL | minimum 60 s | any duration, millisecond granularity (PX) |
| Value size | 25 MiB per value | 512 MiB per string, but the port is meant for small values |
| Key space | the binding’s own namespace | one Redis database shared with the rate limiter — keys are prefixed kv: here to keep the two apart |
The port has no list/scan method, so KV’s list operations have no counterpart to mismatch.
Implementations§
Trait Implementations§
Source§impl KeyValue for RedisKv
impl KeyValue for RedisKv
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, KvError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: &'life2 str,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<(), KvError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), KvError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for RedisKv
impl !UnwindSafe for RedisKv
impl Freeze for RedisKv
impl Send for RedisKv
impl Sync for RedisKv
impl Unpin for RedisKv
impl UnsafeUnpin for RedisKv
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