#[non_exhaustive]pub struct CacheOptions {
pub ttl: Duration,
pub negative_ttl: Duration,
pub max_entries: u64,
}Expand description
How long answers are kept, and how many.
The default keeps a found person or a grant 5 s, “not found” or a denial 1 s, and 10 000
entries of each kind: a burst is answered once, and a change at the source is seen within
seconds. A removed account or a withdrawn permission can still pass for up to ttl after
the source changes unless Cached::invalidate is called; a new one can be refused for
up to negative_ttl. As configuration, a duration reads 5 or 1.5 (seconds), 5s or
250ms.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.ttl: DurationHow long a person found or a grant is kept.
negative_ttl: DurationHow long “no such person” or a denial is kept.
max_entries: u64The most answers kept of each kind (lookups, decisions); 0 keeps none.
Implementations§
Source§impl CacheOptions
impl CacheOptions
Sourcepub const fn negative_ttl(self, negative_ttl: Duration) -> Self
pub const fn negative_ttl(self, negative_ttl: Duration) -> Self
These options with negative_ttl.
Sourcepub const fn max_entries(self, max_entries: u64) -> Self
pub const fn max_entries(self, max_entries: u64) -> Self
These options with max_entries.
Sourcepub fn exceeds_default(&self) -> bool
pub fn exceeds_default(&self) -> bool
Whether answers are kept longer than the defaults, which widens the window in which a revoked account or permission still passes: data for the host to report, not a refusal.
Trait Implementations§
Source§impl Clone for CacheOptions
impl Clone for CacheOptions
impl Copy for CacheOptions
Source§impl Debug for CacheOptions
impl Debug for CacheOptions
Source§impl Default for CacheOptions
impl Default for CacheOptions
Source§impl Describe for CacheOptions
impl Describe for CacheOptions
impl Eq for CacheOptions
impl Fields for CacheOptions
Source§impl Inspect for CacheOptions
impl Inspect for CacheOptions
Source§impl PartialEq for CacheOptions
impl PartialEq for CacheOptions
impl StructuralPartialEq for CacheOptions
Auto Trait Implementations§
impl Freeze for CacheOptions
impl RefUnwindSafe for CacheOptions
impl Send for CacheOptions
impl Sync for CacheOptions
impl Unpin for CacheOptions
impl UnsafeUnpin for CacheOptions
impl UnwindSafe for CacheOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.