pub struct MetadataCache { /* private fields */ }Implementations§
Source§impl MetadataCache
impl MetadataCache
Sourcepub fn new(cache_repo_dir: &Path, repo_url: &str) -> MetadataCache
pub fn new(cache_repo_dir: &Path, repo_url: &str) -> MetadataCache
new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', Url::sanitize($url))).
Sourcepub fn provider_key(file_name: &str) -> String
pub fn provider_key(file_name: &str) -> String
provider-<name with / -> ~>.json.
pub fn read(&self, key: &str) -> Option<Vec<u8>>
Sourcepub fn write(&self, key: &str, contents: &[u8])
pub fn write(&self, key: &str, contents: &[u8])
Atomic write (temp + rename), like Cache::write; a failure is
silent (Composer carries on without cache).
Sourcepub fn with_last_modified(
data: &Value,
last_modified: &str,
escaped: bool,
) -> Option<Vec<u8>>
pub fn with_last_modified( data: &Value, last_modified: &str, escaped: bool, ) -> Option<Vec<u8>>
The content to write when the server provided Last-Modified:
$data['last-modified'] = ... then compact JsonFile::encode, with
JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE for package files
(asyncFetchFile), with flags 0 (slashes and unicode escaped) for
packages.json and the includes (fetchFile).
Auto Trait Implementations§
impl Freeze for MetadataCache
impl RefUnwindSafe for MetadataCache
impl Send for MetadataCache
impl Sync for MetadataCache
impl Unpin for MetadataCache
impl UnsafeUnpin for MetadataCache
impl UnwindSafe for MetadataCache
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