pub struct DocCache(/* private fields */);Expand description
Perl’s document cache (Post.pm L1510-1548): a key-value store per destination directory, persisted there as
CACHE_FILE (kv(key, value), Perl’s keys and values) unless nocache (Perl’s option, Post.pm L678; the
cortex worker, whose every paper gets a fresh directory) or the document has no destination directory (the API):
then in memory. Opened lazily, at the first lookup; every page of a run shares one (PostDocumentOptions::cache)
as Perl’s split pages share their parent’s (new_internal clones it, L687-690).
Implementations§
Source§impl DocCache
impl DocCache
Sourcepub fn with_store<T>(
&self,
dir: Option<&str>,
f: impl FnOnce(&mut SqliteStore) -> T,
) -> T
pub fn with_store<T>( &self, dir: Option<&str>, f: impl FnOnce(&mut SqliteStore) -> T, ) -> T
Run f on the store of dir (opened now when it is the first use).
Sourcepub fn lookup(&self, dir: Option<&str>, key: &str) -> Option<String>
pub fn lookup(&self, dir: Option<&str>, key: &str) -> Option<String>
The value under key in dir’s store.
Sourcepub fn store(&self, dir: Option<&str>, key: &str, value: Option<&str>)
pub fn store(&self, dir: Option<&str>, key: &str, value: Option<&str>)
Store value under key in dir’s store (remove it for None), in a transaction of its own.
Sourcepub fn close(&self)
pub fn close(&self)
Close every store (Perl’s closeCache, Post.pm L1543-1548): its database checkpointed, no side file left for
a package to pick up.
Sourcepub fn close_files(&self)
pub fn close_files(&self)
Close the stores that run on their file, reopened at their next use: before other processes open it (the render workers), the file checkpointed and no handle held across. A store in memory keeps its entries.