We run a multi-tenant process mining SaaS and need a low-latency guardrail to keep the platform fair and stable for every customer. Please design and implement an API usage gate that tracks each tenant’s activity and enforces limits like requests per minute and daily data ingestion, returning clear errors and usage headers when limits are reached. The check should happen in a FastAPI middleware and use a shared Redis for distributed counters with atomic operations. Policies are managed in Postgres but should be cached in Redis for fast reads. Outline the approach (key design, window strategy, cache invalidation, handling policy updates) and ensure no single tenant can overwhelm the app or database.