pub struct ConcurrentKeyspace { /* private fields */ }Expand description
A concurrent keyspace backed by DashMap.
Provides thread-safe access to key-value data without channel overhead. All operations are lock-free for non-conflicting keys.
Implementations§
Source§impl ConcurrentKeyspace
impl ConcurrentKeyspace
Sourcepub fn new(max_memory: Option<usize>, eviction_policy: EvictionPolicy) -> Self
pub fn new(max_memory: Option<usize>, eviction_policy: EvictionPolicy) -> Self
Creates a new concurrent keyspace with optional memory limit.
Sourcepub fn get(&self, key: &str) -> Option<Bytes>
pub fn get(&self, key: &str) -> Option<Bytes>
Gets a value by key, returning None if not found or expired.
Sourcepub fn set(&self, key: String, value: Bytes, ttl: Option<Duration>) -> bool
pub fn set(&self, key: String, value: Bytes, ttl: Option<Duration>) -> bool
Sets a key-value pair with optional TTL.
Sourcepub fn memory_used(&self) -> usize
pub fn memory_used(&self) -> usize
Returns memory usage in bytes.
Trait Implementations§
Source§impl Debug for ConcurrentKeyspace
impl Debug for ConcurrentKeyspace
Auto Trait Implementations§
impl !Freeze for ConcurrentKeyspace
impl !RefUnwindSafe for ConcurrentKeyspace
impl Send for ConcurrentKeyspace
impl Sync for ConcurrentKeyspace
impl Unpin for ConcurrentKeyspace
impl UnwindSafe for ConcurrentKeyspace
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