pub struct FastCache { /* private fields */ }
Expand description
Fast cache with LRU eviction and TTL support
Implementations§
Source§impl FastCache
impl FastCache
Sourcepub fn with_capacity(max_size: usize) -> FastCache
pub fn with_capacity(max_size: usize) -> FastCache
Create a new cache with specified capacity in bytes
Sourcepub fn set(&mut self, key: &str, value: &str, ttl_ms: u64) -> bool
pub fn set(&mut self, key: &str, value: &str, ttl_ms: u64) -> bool
Set a value in the cache with optional TTL and priority
Sourcepub fn set_with_priority(
&mut self,
key: &str,
value: &str,
ttl_ms: u64,
priority: u8,
) -> bool
pub fn set_with_priority( &mut self, key: &str, value: &str, ttl_ms: u64, priority: u8, ) -> bool
Set a value with custom priority
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Get memory usage in bytes
Sourcepub fn optimize_aggressive(&mut self)
pub fn optimize_aggressive(&mut self)
Aggressive optimization (more expensive)
Sourcepub fn optimize_memory(&mut self)
pub fn optimize_memory(&mut self)
Memory-focused optimization with garbage collection
Sourcepub fn batch_set(&mut self, keys_values: &JsValue) -> u32
pub fn batch_set(&mut self, keys_values: &JsValue) -> u32
Advanced batch operations for better performance
Sourcepub fn get_health_metrics(&self) -> JsValue
pub fn get_health_metrics(&self) -> JsValue
Get cache health metrics
Trait Implementations§
Source§impl FromWasmAbi for FastCache
impl FromWasmAbi for FastCache
Source§impl IntoWasmAbi for FastCache
impl IntoWasmAbi for FastCache
Source§impl LongRefFromWasmAbi for FastCache
impl LongRefFromWasmAbi for FastCache
Source§impl OptionFromWasmAbi for FastCache
impl OptionFromWasmAbi for FastCache
Source§impl OptionIntoWasmAbi for FastCache
impl OptionIntoWasmAbi for FastCache
Source§impl RefFromWasmAbi for FastCache
impl RefFromWasmAbi for FastCache
Source§impl RefMutFromWasmAbi for FastCache
impl RefMutFromWasmAbi for FastCache
Source§impl TryFromJsValue for FastCache
impl TryFromJsValue for FastCache
Source§impl VectorFromWasmAbi for FastCache
impl VectorFromWasmAbi for FastCache
Source§impl VectorIntoWasmAbi for FastCache
impl VectorIntoWasmAbi for FastCache
impl SupportsConstructor for FastCache
impl SupportsInstanceProperty for FastCache
impl SupportsStaticProperty for FastCache
Auto Trait Implementations§
impl Freeze for FastCache
impl RefUnwindSafe for FastCache
impl Send for FastCache
impl Sync for FastCache
impl Unpin for FastCache
impl UnwindSafe for FastCache
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> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::Abi
Source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.