Trait git_repository::prelude::CacheAccessExt[][src]

pub trait CacheAccessExt: Access + Sized {
    fn object_cache_size(
        &self,
        bytes: impl Into<Option<usize>>
    ) -> Result<Option<usize>> { ... }
fn apply_environment(self) -> Result<Self> { ... } }
Expand description

Configure how caches are used to speed up various git repository operations

Provided methods

Sets the amount of space used at most for caching most recently accessed fully decoded objects, to Some(bytes), or None to deactivate it entirely.

Note that it is unset by default well but can be enabled once there is time for performance optimization. Well-chosen cache sizes can improve performance particularly if objects are accessed multiple times in a row. The cache is configured to grow gradually.

Note that a cache on application level should be considered as well as the best object access is not doing one.

Returns the previous cache size.

Read well-known environment variables related to caches and apply them to this instance, but not to clones of it - each needs their own configuration.

Note that environment configuration never fails due to invalid environment values, but it should be used with caution as it could be used to cause high memory consumption.

Use the GITOXIDE_DISABLE_PACK_CACHE environment variable to turn off any pack cache, which can be beneficial when it’s known that the cache efficiency is low. Use GITOXIDE_PACK_CACHE_MEMORY=512MB to use up to 512MB of RAM for the pack delta base cache. If none of these are set, the default cache is fast enough to nearly never cause a (marginal) slow-down while providing some gains most of the time. Note that the value given is per-thread.

Implementors