pub struct RedisPubSubInvalidationBus { /* private fields */ }Expand description
Redis Pub/Sub 跨实例失效总线
复用既有 Redis 连接管理(自动重连),Pub/Sub 专用连接。 消息序列化为 ≤1KB JSON,跳过本实例 instance_id 避免自回环。
Implementations§
Source§impl RedisPubSubInvalidationBus
impl RedisPubSubInvalidationBus
Sourcepub fn new(client: ConnectionManager, instance_id: impl Into<String>) -> Self
pub fn new(client: ConnectionManager, instance_id: impl Into<String>) -> Self
创建 Redis Pub/Sub 失效总线
Sourcepub fn disconnected(instance_id: impl Into<String>) -> Self
pub fn disconnected(instance_id: impl Into<String>) -> Self
创建未连接的失效总线(降级为本地失效)
Sourcepub fn with_channel(self, channel: impl Into<String>) -> Self
pub fn with_channel(self, channel: impl Into<String>) -> Self
设置通道名
Sourcepub fn instance_id(&self) -> &str
pub fn instance_id(&self) -> &str
获取本实例 ID
Sourcepub fn push_received(&self, message: InvalidationMessage)
pub fn push_received(&self, message: InvalidationMessage)
接收消息(从外部订阅循环调用,写入本地缓冲)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RedisPubSubInvalidationBus
impl !RefUnwindSafe for RedisPubSubInvalidationBus
impl !UnwindSafe for RedisPubSubInvalidationBus
impl Send for RedisPubSubInvalidationBus
impl Sync for RedisPubSubInvalidationBus
impl Unpin for RedisPubSubInvalidationBus
impl UnsafeUnpin for RedisPubSubInvalidationBus
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> 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> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more