Files
git.stella-ops.org/docs/features/checked/sbomservice/sbom-lineage-hover-cache-with-valkey.md
2026-02-14 09:11:48 +02:00

28 lines
2.0 KiB
Markdown

# SBOM Lineage Hover Cache with Valkey
## Module
SbomService
## Status
IMPLEMENTED
## Description
Valkey-backed (Redis-compatible) caching layer for SBOM lineage graph hover card data. Pre-computes and caches component diff summaries, VEX delta counts, and provenance metadata for instant hover card rendering without round-trips to PostgreSQL.
## Implementation Details
- **Hover cache interface and implementation**: `src/SbomService/StellaOps.SbomService/Services/LineageHoverCache.cs` -- `ILineageHoverCache` with `GetAsync`, `SetAsync`, `InvalidateAsync` for hover card data; 5-minute TTL targeting <150ms response times
- **Valkey compare cache**: `src/SbomService/StellaOps.SbomService/Services/ValkeyLineageCompareCache.cs` -- `ILineageCompareCache` implementation using `IDistributedCache` (Valkey/Redis) with 10-minute TTL, cache hit/miss/invalidation counters, and `ActivitySource` tracing
- **In-memory fallback**: `src/SbomService/StellaOps.SbomService/Services/InMemoryLineageCompareCache.cs` -- in-memory `ILineageCompareCache` for testing and non-Valkey deployments
- **Cache interface**: `src/SbomService/StellaOps.SbomService/Services/ILineageCompareCache.cs` -- compare cache contract
- **Hover card model**: `src/SbomService/StellaOps.SbomService/Models/SbomProjectionModels.cs` -- `SbomLineageHoverCard` used as cached entity
- **Frontend hover card**: `src/Web/StellaOps.Web/src/app/features/lineage/components/lineage-hover-card/lineage-hover-card.component.ts` -- Angular hover card component
- **DI registration**: `src/SbomService/StellaOps.SbomService/Program.cs` -- Valkey cache services registered in DI
- **Source**: SPRINT_20251228_005_BE_sbom_lineage_graph_i.md
## E2E Test Plan
- [ ] Verify hover card data is cached with 5-minute TTL
- [ ] Test cache invalidation when artifact digest changes
- [ ] Verify <150ms response time for cached hover card requests
- [ ] Test Valkey compare cache hit/miss tracking metrics
- [ ] Verify in-memory fallback works when Valkey is unavailable