MCPcopy Create free account
hub / github.com/SpecterOps/Nemesis / set

Method set

projects/frontend/src/utils/fileCache.js:68–101  ·  view source on GitHub ↗

* Add item to cache

(url, response)

Source from the content-addressed store, hash-verified

66 * Add item to cache
67 */
68 async set(url, response) {
69 const key = this.getCacheKey(url);
70
71 // Clone the response to read it
72 const responseClone = response.clone();
73
74 // Read the response body as blob (more reliable than storing Response objects)
75 const blob = await responseClone.blob();
76
77 // Check actual blob size
78 const fileSize = blob.size;
79
80 // Don't cache if too large
81 if (fileSize > this.maxFileSize) {
82 log('[FileCache] File too large to cache:', key, `(${fileSize} bytes)`);
83 return;
84 }
85
86 // Store blob and metadata separately to avoid Response stream issues
87 const entry = {
88 blob: blob,
89 status: response.status,
90 statusText: response.statusText,
91 headers: new Headers(response.headers), // Clone headers
92 timestamp: Date.now(),
93 size: fileSize
94 };
95
96 this.cache.set(key, entry);
97 log('[FileCache] Cached:', key, `(${fileSize} bytes)`);
98
99 // Enforce size limit
100 this.enforceSizeLimit();
101 }
102
103 /**
104 * Remove oldest entries if cache is full (LRU)

Callers 15

FileBrowserFunction · 0.80
fetchLinkedFilesFunction · 0.80
LinkedFilesSectionFunction · 0.80
recordFileViewFunction · 0.80
ContainersFunction · 0.80
FileListFunction · 0.80
fetchTitusResultsFunction · 0.80
ChromiumLoginsFunction · 0.80
ChromiumStateKeysFunction · 0.80
ChromiumHistoryFunction · 0.80
ChromiumCookiesFunction · 0.80
ChromiumDownloadsFunction · 0.80

Calls 3

getCacheKeyMethod · 0.95
enforceSizeLimitMethod · 0.95
logFunction · 0.85

Tested by

no test coverage detected