pub struct PrefixMatcher { /* private fields */ }Expand description
String prefix matcher for finding keys that start with a specific string.
This matcher is useful for finding groups of related cache entries that follow a naming convention with common prefixes.
§Examples
use simple_cacher::*;
use std::time::Duration;
let mut cache = SimpleCacher::new(Duration::from_secs(300));
cache.insert("user:alice".to_string(), "Alice Johnson".to_string());
cache.insert("user:bob".to_string(), "Bob Smith".to_string());
cache.insert("admin:charlie".to_string(), "Charlie Admin".to_string());
let user_matcher = PrefixMatcher::new("user:");
let users = cache.get_all_by_matcher(&user_matcher);
assert_eq!(users.len(), 2); // Found alice and bobImplementations§
Trait Implementations§
Source§impl Matcher<&str> for PrefixMatcher
impl Matcher<&str> for PrefixMatcher
Auto Trait Implementations§
impl Freeze for PrefixMatcher
impl RefUnwindSafe for PrefixMatcher
impl Send for PrefixMatcher
impl Sync for PrefixMatcher
impl Unpin for PrefixMatcher
impl UnwindSafe for PrefixMatcher
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