pub struct CacheConfig {
pub max_capacity: u64,
pub ttl_secs: u64,
pub tti_secs: Option<u64>,
pub initial_capacity: Option<u64>,
pub enable_stats: bool,
}Expand description
缓存配置
Fields§
§max_capacity: u64最大容量
ttl_secs: u64TTL(秒)- 时间到期后自动过期
tti_secs: Option<u64>TTI(秒)- 空闲时间到期后自动过期
initial_capacity: Option<u64>初始容量(预分配)
enable_stats: bool是否启用统计
Implementations§
Source§impl CacheConfig
impl CacheConfig
Sourcepub fn high_performance() -> Self
pub fn high_performance() -> Self
创建高性能缓存配置
Sourcepub fn low_memory() -> Self
pub fn low_memory() -> Self
创建低内存占用配置
Trait Implementations§
Source§impl Clone for CacheConfig
impl Clone for CacheConfig
Source§fn clone(&self) -> CacheConfig
fn clone(&self) -> CacheConfig
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 CacheConfig
impl Debug for CacheConfig
Source§impl Default for CacheConfig
impl Default for CacheConfig
Source§impl<'de> Deserialize<'de> for CacheConfig
impl<'de> Deserialize<'de> for CacheConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CacheConfig
impl RefUnwindSafe for CacheConfig
impl Send for CacheConfig
impl Sync for CacheConfig
impl Unpin for CacheConfig
impl UnsafeUnpin for CacheConfig
impl UnwindSafe for CacheConfig
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