pub struct RedisSet { /* private fields */ }Expand description
Minimal Redis set helper with TTL and basic bounding.
Implementations§
Source§impl RedisSet
impl RedisSet
pub async fn new(url: &str, key: &str, ttl_seconds: u64) -> Result<Self>
pub async fn new_with_name( url: &str, key: &str, ttl_seconds: u64, connection_name: Option<&str>, ) -> Result<Self>
Sourcepub async fn new_sentinel(
sentinel_urls: &[&str],
master_name: &str,
key: &str,
ttl_seconds: u64,
connection_name: Option<&str>,
) -> Result<Self>
pub async fn new_sentinel( sentinel_urls: &[&str], master_name: &str, key: &str, ttl_seconds: u64, connection_name: Option<&str>, ) -> Result<Self>
Creates a new RedisSet connected via Sentinel.
Sourcepub async fn add_items(&self, items: &[String]) -> Result<()>
pub async fn add_items(&self, items: &[String]) -> Result<()>
Adds items to the set and refreshes TTL.
Sourcepub async fn remove_items(&self, items: &[String]) -> Result<()>
pub async fn remove_items(&self, items: &[String]) -> Result<()>
Removes items from the set.
Sourcepub async fn remove_item(&self, item: &str) -> Result<()>
pub async fn remove_item(&self, item: &str) -> Result<()>
Single item remove.
Sourcepub async fn load_items(&self) -> Result<Vec<String>>
pub async fn load_items(&self) -> Result<Vec<String>>
Returns all items in the set.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RedisSet
impl !RefUnwindSafe for RedisSet
impl Send for RedisSet
impl Sync for RedisSet
impl Unpin for RedisSet
impl UnsafeUnpin for RedisSet
impl !UnwindSafe for RedisSet
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