pub struct FileCache { /* private fields */ }Implementations§
Source§impl FileCache
impl FileCache
Sourcepub async fn new(root: impl AsRef<Path>) -> Result<Self>
pub async fn new(root: impl AsRef<Path>) -> Result<Self>
Creates a new file cache that stores data in the given directory.
Sourcepub async fn global_cache() -> Result<Self>
pub async fn global_cache() -> Result<Self>
Returns a cache setup to use the global default cache path if it can be determined, otherwise this will error
Sourcepub fn global_cache_path() -> Option<PathBuf>
pub fn global_cache_path() -> Option<PathBuf>
Returns the global default cache path if it can be determined, otherwise returns None
Trait Implementations§
Source§impl Cache for FileCache
impl Cache for FileCache
Source§async fn put_data(
&self,
digest: ContentDigest,
data: ContentStream,
) -> Result<(), Error>
async fn put_data( &self, digest: ContentDigest, data: ContentStream, ) -> Result<(), Error>
Puts the data with the given hash into the cache
Source§async fn get_data(
&self,
digest: &ContentDigest,
) -> Result<Option<ContentStream>, Error>
async fn get_data( &self, digest: &ContentDigest, ) -> Result<Option<ContentStream>, Error>
Gets the data with the given hash from the cache. Returns None if the data is not in the cache.
Source§async fn put_release(
&self,
package: &PackageRef,
release: &Release,
) -> Result<(), Error>
async fn put_release( &self, package: &PackageRef, release: &Release, ) -> Result<(), Error>
Puts the release data into the cache.
Source§async fn get_release(
&self,
package: &PackageRef,
version: &Version,
) -> Result<Option<Release>, Error>
async fn get_release( &self, package: &PackageRef, version: &Version, ) -> Result<Option<Release>, Error>
Gets the release data from the cache. Returns None if the data is not in the cache.
Auto Trait Implementations§
impl Freeze for FileCache
impl RefUnwindSafe for FileCache
impl Send for FileCache
impl Sync for FileCache
impl Unpin for FileCache
impl UnwindSafe for FileCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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