Struct sequoia_openpgp::packet::signature::cache::SignatureVerificationCache
source · pub struct SignatureVerificationCache { /* private fields */ }
Expand description
A signature verification cache.
Implementations§
source§impl SignatureVerificationCache
impl SignatureVerificationCache
sourcepub fn cache_hits() -> usize
pub fn cache_hits() -> usize
Returns the number of cache hits.
sourcepub fn cache_misses() -> usize
pub fn cache_misses() -> usize
Returns the number of cache misses.
sourcepub fn insertions() -> usize
pub fn insertions() -> usize
Returns the number of cache insertions.
This returns the number of times an entry was added to the
cache since the program started or the last time
SignatureVerificationCache::clear_insertions
was called.
This does not include entries added via
SignatureVerificationCache::restore
.
sourcepub fn clear_insertions()
pub fn clear_insertions()
Resets the insertions counter.
sourcepub fn restore<'a, F>(
entries: impl Iterator<Item = Vec<u8>> + Send + Sync + 'static,
finished: F,
)
pub fn restore<'a, F>( entries: impl Iterator<Item = Vec<u8>> + Send + Sync + 'static, finished: F, )
Restores the signature verification cache.
This merges the entries into the existing signature cache.
The values are the values as returned by Entry::value
.
The iterator is Send
, Sync
and 'static
, because this
function may spawn a thread to avoid blocking the main thread.
When the restore is complete, finished
is called.
sourcepub fn dump<'a>() -> impl IntoIterator<Item = Entry>
pub fn dump<'a>() -> impl IntoIterator<Item = Entry>
Dumps the contents of the cache.
This clones the cache to avoid holding locks too long.
The values returned by Entry::value
may be written to a
file, and restored using
SignatureVerificationCache::restore
.
Before saving them, you may want to check if there were any
insertions using SignatureVerificationCache::insertions
.
Also, you may want to prune the entries to avoid having the cache grow without bound.