SharedCache

Struct SharedCache 

Source
pub struct SharedCache {
    pub location: CacheLocation,
    /* private fields */
}
Expand description

Thread-safe shared cache implementation

Fields§

§location: CacheLocation

Implementations§

Source§

impl SharedCache

Source

pub fn new(repo_path: Option<&Path>) -> Result<Self>

Create a new shared cache instance

Source

pub fn new_with_cache_dir( repo_path: Option<&Path>, cache_dir: PathBuf, ) -> Result<Self>

Create a new shared cache instance with explicit cache directory (for testing)

Source

pub fn save_index(&self) -> Result<()>

Save the current index to disk with comprehensive error handling

Source

pub fn get(&self, key: &str, component: &str) -> Result<Vec<u8>>

Get a cache entry

Source

pub fn put(&self, key: &str, component: &str, data: &[u8]) -> Result<()>

Store a cache entry

Source

pub fn exists(&self, key: &str, component: &str) -> bool

Check if a cache entry exists

Source

pub fn delete(&self, key: &str, component: &str) -> Result<()>

Delete a cache entry

Source

pub fn cleanup(&self) -> Result<()>

Clean up old cache entries

Source

pub fn migrate_from_local(&self, local_cache_path: &Path) -> Result<()>

Migrate cache from local to shared location

Source

pub fn clear_project(&self) -> Result<()>

Get cache statistics Clear all cache entries for this project

Source

pub fn get_stats(&self) -> CacheStats

Source

pub fn get_full_stats(&self) -> Result<FullCacheStats>

Source

pub fn with_auto_pruning( repo_path: Option<&Path>, pruner: AutoPruner, ) -> Result<Self>

Create a new shared cache with auto-pruning enabled

Source

pub fn trigger_pruning_if_needed(&self) -> Result<PruneStats>

Trigger pruning if needed based on auto-pruner configuration

Source

pub fn trigger_pruning_if_needed_with_new_entry( &self, new_entry_size: usize, ) -> Result<PruneStats>

Trigger pruning if needed, considering a new entry of the given size

Source

pub fn trigger_pruning(&self) -> Result<PruneStats>

Manually trigger pruning

Source

pub fn prune_with_strategy(&self, strategy: PruneStrategy) -> Result<PruneStats>

Prune entries with a specific strategy

Source

pub fn clean_orphaned_entries(&self) -> Result<usize>

Clean up orphaned index entries where files no longer exist

Source

pub fn cleanup_old_entries(&self, max_age_days: i64) -> Result<usize>

Clean up entries older than specified days

Trait Implementations§

Source§

impl Debug for SharedCache

Source§

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

Formats the value using the given formatter. 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, U> ExactFrom<T> for U
where U: TryFrom<T>,

Source§

fn exact_from(value: T) -> U

Source§

impl<T, U> ExactInto<U> for T
where U: ExactFrom<T>,

Source§

fn exact_into(self) -> U

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> OverflowingInto<U> for T
where U: OverflowingFrom<T>,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> RoundingInto<U> for T
where U: RoundingFrom<T>,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> SaturatingInto<U> for T
where U: SaturatingFrom<T>,

Source§

impl<T> ToDebugString for T
where T: Debug,

Source§

fn to_debug_string(&self) -> String

Returns the String produced by Ts Debug implementation.

§Examples
use malachite_base::strings::ToDebugString;

assert_eq!([1, 2, 3].to_debug_string(), "[1, 2, 3]");
assert_eq!(
    [vec![2, 3], vec![], vec![4]].to_debug_string(),
    "[[2, 3], [], [4]]"
);
assert_eq!(Some(5).to_debug_string(), "Some(5)");
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T, U> WrappingInto<U> for T
where U: WrappingFrom<T>,

Source§

fn wrapping_into(self) -> U