pub struct MemoryKvStore { /* private fields */ }Expand description
In-memory key-value store using lock-free concurrent hashmap.
Thread-safe and optimized for high-concurrency read/write workloads.
Uses DashMap internally for O(1) average-case operations.
§Example
use trueno_db::kv::{KvStore, MemoryKvStore};
let store = MemoryKvStore::new();
store.set("hello", b"world".to_vec()).await?;
assert_eq!(store.get("hello").await?, Some(b"world".to_vec()));Implementations§
Source§impl MemoryKvStore
impl MemoryKvStore
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create with pre-allocated capacity.
Trait Implementations§
Source§impl Default for MemoryKvStore
impl Default for MemoryKvStore
Auto Trait Implementations§
impl Freeze for MemoryKvStore
impl !RefUnwindSafe for MemoryKvStore
impl Send for MemoryKvStore
impl Sync for MemoryKvStore
impl Unpin for MemoryKvStore
impl UnsafeUnpin for MemoryKvStore
impl UnwindSafe for MemoryKvStore
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