pub struct MemoryConfig {
pub write_key: String,
pub max_items: usize,
pub max_fetch_size: usize,
}Expand description
Configuration options for the in-memory data store.
This struct provides the configuration parameters needed to create a new MemoryStore instance. It controls the store’s identification, capacity, and fetch size limits.
§Examples
use transientdb::{MemoryConfig, MemoryStore};
let config = MemoryConfig {
write_key: "my-store".into(),
max_items: 1000,
max_fetch_size: 1024 * 1024, // 1MB
};
let store = MemoryStore::new(config);Fields§
§write_key: StringKey used to identify writes to this store. This is included in the metadata of each batch of data fetched from the store.
max_items: usizeMaximum number of items to store before old items are removed. Once this limit is reached, adding new items will remove the oldest items to make space.
max_fetch_size: usizeMaximum size in bytes that can be fetched in a single operation. This prevents memory spikes during fetch operations by limiting the amount of data returned.
Trait Implementations§
Source§impl Clone for MemoryConfig
impl Clone for MemoryConfig
Source§fn clone(&self) -> MemoryConfig
fn clone(&self) -> MemoryConfig
Returns a duplicate of the value. Read more
1.0.0 · 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 Freeze for MemoryConfig
impl RefUnwindSafe for MemoryConfig
impl Send for MemoryConfig
impl Sync for MemoryConfig
impl Unpin for MemoryConfig
impl UnwindSafe for MemoryConfig
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