pub struct RedisWatcher { /* private fields */ }
Implementations§
Source§impl RedisWatcher
impl RedisWatcher
Sourcepub fn new(redis_url: &str, options: WatcherOptions) -> Result<Self>
pub fn new(redis_url: &str, options: WatcherOptions) -> Result<Self>
Create a new Redis watcher for standalone Redis
Sourcepub fn new_cluster(cluster_urls: &str, options: WatcherOptions) -> Result<Self>
pub fn new_cluster(cluster_urls: &str, options: WatcherOptions) -> Result<Self>
Create a new Redis watcher for Redis Cluster
Note: Redis Cluster PubSub messages don’t propagate between nodes. All instances MUST connect to the SAME node for pub/sub to work. This method uses the first URL as the fixed PubSub node.
§Arguments
cluster_urls
- Comma-separated Redis URLs (first URL used for PubSub)options
- Watcher configuration options
Sourcepub async fn wait_for_ready(&self)
pub async fn wait_for_ready(&self)
Wait for subscription to be ready (similar to Go’s WaitGroup.Wait())
This ensures that the watcher is fully subscribed before publishing messages. Recommended to call this after creating the watcher and before any policy operations.
Trait Implementations§
Source§impl Drop for RedisWatcher
impl Drop for RedisWatcher
Auto Trait Implementations§
impl Freeze for RedisWatcher
impl RefUnwindSafe for RedisWatcher
impl Send for RedisWatcher
impl Sync for RedisWatcher
impl Unpin for RedisWatcher
impl UnwindSafe for RedisWatcher
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