MCPcopy Index your code
hub / github.com/shadow1ng/fscan / Cache

Method Cache

web/api/project.go:276–293  ·  view source on GitHub ↗

Cache 查看项目缓存摘要

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

274
275// Cache 查看项目缓存摘要
276func (h *ProjectHandler) Cache(w http.ResponseWriter, r *http.Request) {
277 if r.Method != http.MethodGet {
278 http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
279 return
280 }
281 id := r.URL.Query().Get("id")
282 p := h.store.Get(id)
283 if p == nil {
284 writeJSON(w, http.StatusNotFound, map[string]string{"error": "project not found"})
285 return
286 }
287 writeJSON(w, http.StatusOK, map[string]interface{}{
288 "hosts": len(p.Hosts),
289 "ports": len(p.Ports),
290 "results": len(p.Results),
291 "cached_ports": h.store.CachedHostPorts(id),
292 })
293}

Callers

nothing calls this directly

Calls 4

writeJSONFunction · 0.85
CachedHostPortsMethod · 0.80
ErrorMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected