perf: use Redis for favicon cache with 24h TTL
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 7s
Mirror to GitHub / mirror (push) Failing after 5s
Tests / test (push) Successful in 27s

Favicons are now cached in Valkey/Redis instead of an in-memory map:
- TTL: 24 hours (up from 1 hour in-memory)
- ETag derived from body SHA256 (no extra storage needed)
- Falls back to in-memory on cache miss when Valkey is unavailable
- GetBytes/SetBytes added to cache package for raw byte storage

In-memory faviconCache map, sync.RWMutex, and time-based expiry
logic removed from handlers.go.
This commit is contained in:
Franz Kafka 2026-03-23 14:38:32 +00:00
parent 352264509c
commit b57a041b6a
4 changed files with 59 additions and 60 deletions

View file

@ -67,7 +67,7 @@ func newTestServer(t *testing.T) (*httptest.Server, *httpapi.Handler) {
EnginesConfig: nil,
})
h := httpapi.NewHandler(svc, nil, "https://src.example.com")
h := httpapi.NewHandler(svc, nil, "https://src.example.com", nil)
mux := http.NewServeMux()
mux.HandleFunc("/healthz", h.Healthz)