Skip to main content

DocCache

Struct DocCache 

Source
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

Source

pub fn new(nocache: bool) -> Self

A cache of its own; nocache keeps it in memory.

Source

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).

Source

pub fn lookup(&self, dir: Option<&str>, key: &str) -> Option<String>

The value under key in dir’s store.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for DocCache

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DocCache

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DocCache

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.