diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-08-26 19:59:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-26 23:59:17 +0000 |
commit | c89a20b42899abff5c3ea84660c8110806c5fbee (patch) | |
tree | e9d93ce49b391faf0058bd3223ba72d398f78fc8 /cli/lsp/documents.rs | |
parent | e13230226fe91498b3a5f28a8de6edbe4f164944 (diff) |
perf(cache): single cache file for remote modules (#24983)
This changes the global cache to store the cache file for remote modules
in one file instead of two.
Diffstat (limited to 'cli/lsp/documents.rs')
-rw-r--r-- | cli/lsp/documents.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index a8ddc8fd7..80c5a4dc5 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -2,7 +2,6 @@ use super::cache::calculate_fs_version; use super::cache::LspCache; -use super::cache::LSP_DISALLOW_GLOBAL_TO_LOCAL_COPY; use super::config::Config; use super::resolver::LspResolver; use super::testing::TestCollector; @@ -872,22 +871,19 @@ impl FileSystemDocuments { } else { let http_cache = cache.for_specifier(file_referrer); let cache_key = http_cache.cache_item_key(specifier).ok()?; - let bytes = http_cache - .read_file_bytes(&cache_key, None, LSP_DISALLOW_GLOBAL_TO_LOCAL_COPY) - .ok()??; - let specifier_headers = http_cache.read_headers(&cache_key).ok()??; + let cached_file = http_cache.get(&cache_key, None).ok()??; let (_, maybe_charset) = deno_graph::source::resolve_media_type_and_charset_from_headers( specifier, - Some(&specifier_headers), + Some(&cached_file.metadata.headers), ); let content = deno_graph::source::decode_owned_source( specifier, - bytes, + cached_file.content, maybe_charset, ) .ok()?; - let maybe_headers = Some(specifier_headers); + let maybe_headers = Some(cached_file.metadata.headers); Document::new( specifier.clone(), content.into(), |