pub struct CacheConfig {
pub enabled: bool,
pub fetch_timeout_secs: u64,
pub max_concurrent_fetches: usize,
}Expand description
Configuration for HTTP caching behavior.
Controls cache settings for registry requests. The cache uses ETag and Last-Modified headers for validation, minimizing network traffic.
§Defaults
enabled:truefetch_timeout_secs:10(10 seconds per package)max_concurrent_fetches:20(20 concurrent requests)
§Examples
use deps_lsp::config::CacheConfig;
let config = CacheConfig {
enabled: true,
fetch_timeout_secs: 5,
max_concurrent_fetches: 20,
};
assert_eq!(config.fetch_timeout_secs, 5);Fields§
§enabled: boolWhether deps_core::cache::HttpCache’s entry map is used at all (issue #482):
false bypasses it entirely (fetch fresh every time, never store).
Offline override: while network.offline (see NetworkConfig::offline) is
set, this flag’s false value is overridden and treated as true — otherwise a
warm entry fetched before going offline could never survive an online→offline
transition, since nothing would have been stored while online in the first place.
Maven exception: deps-maven’s peek_cached-based stale-data fallback
(crates/deps-maven/src/registry.rs) behaves differently from every other
ecosystem under enabled: false, which has no equivalent second-layer fallback to
diverge on. This only “always misses” for a process that started cold with the
flag already off — peek_cached reads the entry map directly and
set_cache_enabled never clears it, so a live true -> false toggle leaves
every already-stored entry servable through this fallback indefinitely.
fetch_timeout_secs: u64Timeout for fetching a single package’s versions (default: 10 seconds)
max_concurrent_fetches: usizeMaximum concurrent package fetches (default: 20)
Trait Implementations§
Source§impl Clone for CacheConfig
impl Clone for CacheConfig
Source§fn clone(&self) -> CacheConfig
fn clone(&self) -> CacheConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CacheConfig
impl Debug for CacheConfig
Source§impl Default for CacheConfig
impl Default for CacheConfig
Source§impl<'de> Deserialize<'de> for CacheConfig
impl<'de> Deserialize<'de> for CacheConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for CacheConfig
impl RefUnwindSafe for CacheConfig
impl Send for CacheConfig
impl Sync for CacheConfig
impl Unpin for CacheConfig
impl UnsafeUnpin for CacheConfig
impl UnwindSafe for CacheConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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