pub struct MemoryConfig {
pub max_capacity: u64,
pub initial_capacity: usize,
pub default_ttl: Duration,
pub ttl_random_range: Option<Duration>,
pub time_to_idle: Option<Duration>,
pub system_name: String,
}Expand description
内存缓存配置结构
Fields§
§max_capacity: u64最大容量(条目数)
initial_capacity: usize初始容量(条目数)
default_ttl: Duration默认 TTL(过期时间)
ttl_random_range: Option<Duration>TTL 随机化范围(防缓存雪崩) 实际 TTL 会在 default_ttl ± random_range 范围内随机
time_to_idle: Option<Duration>空闲过期时间(秒),None 表示不过期
system_name: String系统标识(用于 Key 前缀)
Implementations§
Source§impl MemoryConfig
impl MemoryConfig
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 moreSource§impl Debug for MemoryConfig
impl Debug for MemoryConfig
Auto 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