pub struct WriteOptions {
pub cache_mode: Option<CacheMode>,
pub ttl: u64,
pub update_ttl: bool,
}Expand description
Options for write operations.
Specifies optional parameters that control write behavior, including caching and time-to-live (TTL) expiration.
Fields§
§cache_mode: Option<CacheMode>Cache mode for the write operation.
ttl: u64Time-to-live in hours (0 = no expiration).
update_ttl: boolWhether to update TTL on existing records.
Implementations§
Source§impl WriteOptions
impl WriteOptions
Sourcepub fn with_cache_mode(self, cache_mode: CacheMode) -> Self
pub fn with_cache_mode(self, cache_mode: CacheMode) -> Self
Sets the cache mode.
Sourcepub fn with_update_ttl(self, update_ttl: bool) -> Self
pub fn with_update_ttl(self, update_ttl: bool) -> Self
Sets whether to update TTL on existing records.
Sourcepub fn evict_after_write() -> Self
pub fn evict_after_write() -> Self
Creates WriteOptions with evict-after-write cache mode.
Sourcepub fn with_expiration(ttl_hours: u64) -> Self
pub fn with_expiration(ttl_hours: u64) -> Self
Creates WriteOptions with a TTL.
Sourcepub fn expiration_time_ms(&self, current_time_ms: u64) -> u64
pub fn expiration_time_ms(&self, current_time_ms: u64) -> u64
Returns the expiration time in milliseconds from now, or 0 if no TTL.
Sourcepub fn get_expiration_time(&self) -> u32
pub fn get_expiration_time(&self) -> u32
Returns the packed expiration_time (hours since epoch) for use in BinEntry.
Returns 0 if no TTL is set. Uses noxu_util::ttl_hours_to_expiration
to compute the expiration time relative to now.
Trait Implementations§
Source§impl Clone for WriteOptions
impl Clone for WriteOptions
Source§fn clone(&self) -> WriteOptions
fn clone(&self) -> WriteOptions
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 moreSource§impl Debug for WriteOptions
impl Debug for WriteOptions
Source§impl Default for WriteOptions
impl Default for WriteOptions
impl Eq for WriteOptions
Source§impl PartialEq for WriteOptions
impl PartialEq for WriteOptions
Source§fn eq(&self, other: &WriteOptions) -> bool
fn eq(&self, other: &WriteOptions) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for WriteOptions
Auto Trait Implementations§
impl Freeze for WriteOptions
impl RefUnwindSafe for WriteOptions
impl Send for WriteOptions
impl Sync for WriteOptions
impl Unpin for WriteOptions
impl UnsafeUnpin for WriteOptions
impl UnwindSafe for WriteOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.