pub struct Cache<S> { /* private fields */ }
Expand description
A way to access objects along with pre-configured thread-local caches for packed base objects as well as objects themselves.
By default, no cache will be used.
Implementations
Dissolve this instance, discard all caches, and return the inner implementation.
Use this methods directly after creating a new instance to add a constructor for pack caches.
These are used to speed up decoding objects which are located in packs, reducing long delta chains by storing their intermediate results.
pub fn with_object_cache(
self,
create: impl Fn() -> Box<ObjectCache> + Send + Sync + 'static
) -> Self
pub fn with_object_cache(
self,
create: impl Fn() -> Box<ObjectCache> + Send + Sync + 'static
) -> Self
Use this methods directly after creating a new instance to add a constructor for object caches.
Only use this kind of cache if the same objects are repeatedly accessed for great speedups, usually during diffing of trees.
Set the pack cache constructor on this instance.
pub fn set_object_cache(
&mut self,
create: impl Fn() -> Box<ObjectCache> + Send + Sync + 'static
)
pub fn set_object_cache(
&mut self,
create: impl Fn() -> Box<ObjectCache> + Send + Sync + 'static
)
Set the object cache constructor on this instance.
Remove the current pack cache as well as its constructor from this instance.
Remove the current object cache as well as its constructor from this instance.
Trait Implementations
The error returned by try_find()
Returns true if the object exists in the database.
The error returned by try_find()
Returns true if the object exists in the database.
Find an object matching id
in the database while placing its raw, undecoded data into buffer
.
A pack_cache
can be used to speed up subsequent lookups, set it to crate::cache::Never
if the
workload isn’t suitable for caching. Read more
Like Find::try_find()
, but with support for controlling the pack cache.
A pack_cache
can be used to speed up subsequent lookups, set it to crate::cache::Never
if the
workload isn’t suitable for caching. Read more
Find the packs location where an object with id
can be found in the database, or None
if there is no pack
holding the object. Read more
Obtain a vector of all offsets, in index order, along with their object id.
Return the find::Entry
for location
if it is backed by a pack. Read more
Auto Trait Implementations
impl<S> !RefUnwindSafe for Cache<S>
impl<S> !UnwindSafe for Cache<S>
Blanket Implementations
Mutably borrows from an owned value. Read more
The equivalent of Access::load
.
Like try_find(…)
, but flattens the Result<Option<_>>
into a single Result
making a non-existing object an error.