pub struct LocalStorage { /* private fields */ }Expand description
Persistent LocalStorage with instant in-memory reads and background WAL durability.
Implementations§
Source§impl LocalStorage
impl LocalStorage
Sourcepub fn open(wal_path: impl Into<PathBuf>) -> Result<LocalStorage, Error>
pub fn open(wal_path: impl Into<PathBuf>) -> Result<LocalStorage, Error>
Opens or initializes LocalStorage at the specified WAL file path.
Sourcepub fn default_instance() -> LocalStorage
pub fn default_instance() -> LocalStorage
Default global LocalStorage instance anchored to app_data/storage.wal.
Sourcepub fn get(&self, key: &str) -> Option<String>
pub fn get(&self, key: &str) -> Option<String>
Instant $O(1)$ zero-latency read from in-memory cache.
Sourcepub fn set(&self, key: impl Into<String>, val: impl Into<String>)
pub fn set(&self, key: impl Into<String>, val: impl Into<String>)
Stores a value, updating in-memory cache and appending to WAL.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for LocalStorage
impl Clone for LocalStorage
Source§fn clone(&self) -> LocalStorage
fn clone(&self) -> LocalStorage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Forget for LocalStorage
impl Freeze for LocalStorage
impl Move for LocalStorage
impl RefUnwindSafe for LocalStorage
impl Send for LocalStorage
impl Sync for LocalStorage
impl Unpin for LocalStorage
impl UnsafeUnpin for LocalStorage
impl UnwindSafe for LocalStorage
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