Security Metrics Cache
Component Detail
Infrastructure
low complexity
backend
0
Dependencies
1
Dependents
0
Entities
0
Integrations
Description
In-process or Redis-backed cache layer that stores aggregated security metric results keyed by organization ID and time window. Prevents repeated expensive aggregation queries on every dashboard poll. Exposes TTL-aware get/set operations and manual invalidation for use after significant security events.
security-metrics-cache
Responsibilities
- Cache security metric aggregations by orgId and window key
- Enforce configurable TTL (default 60 seconds) per cache entry
- Support manual cache invalidation triggered by significant events
- Track cache hit/miss rates for observability
Interfaces
get(key: string): SecurityMetrics | null
set(key: string, value: SecurityMetrics, ttlSeconds: number): void
invalidate(key: string): void
invalidateAllForOrg(orgId: string): void
getStats(): CacheStats