# Phase 5: Infrastructure Adapters ## Overview Implement infrastructure adapters for caching (Redis), event bus (Kafka), background job scheduling (asynq), and multi-tenancy support. ## Tasks ### 5.1 Cache Implementation - [5.1.1 - Install Redis Client](./5.1.1-install-githubcomredisgo-redisv9.md) - [5.1.2 - Create Cache Interface](./5.1.2-create-pkginfracachecachego-interface.md) - [5.1.3 - Implement Redis Cache](./5.1.3-implement-internalinfracacheredis_cachego.md) - [5.1.4 - Add Redis Config](./5.1.4-add-redis-config-to-configdefaultyaml.md) - [5.1.5 - Register in DI Container](./5.1.5-register-in-di-container.md) - [5.1.6 - Add Cache Middleware](./5.1.6-add-cache-middleware-for-selected-routes-optional.md) ### 5.2 Event Bus Implementation - [5.2.1 - Create Event Bus Interface](./5.2.1-create-pkgeventbuseventbusgo-interface.md) - [5.2.2 - Implement In-Process Bus](./5.2.2-implement-internalinfrabusinprocess_busgo.md) - [5.2.3 - Implement Kafka Bus](./5.2.3-implement-internalinfrabuskafka_busgo.md) - [5.2.4 - Add Kafka Config](./5.2.4-add-kafka-config-to-configdefaultyaml.md) ### 5.3 Background Job Scheduler - [5.3.1 - Install Asynq](./5.3.1-install-githubcomhibikenasynq.md) - [5.3.2 - Create Scheduler Interface](./5.3.2-create-pkgschedulerschedulergo-interface.md) - [5.3.3 - Implement Asynq Scheduler](./5.3.3-implement-internalinfraschedulerasynq_schedulergo.md) - [5.3.4 - Add Cron Support](./5.3.4-add-cron-support.md) ### 5.4 Multi-tenancy Support - [5.4.1 - Create Tenant Resolver Interface](./5.4.1-create-pkgtenanttenantgo-interface.md) - [5.4.2 - Implement Tenant Resolver](./5.4.2-implement-internaltenantresolvergo.md) - [5.4.3 - Add Tenant Middleware](./5.4.3-add-tenant-middleware.md) - [5.4.4 - Update Ent Queries](./5.4.4-update-ent-queries-with-tenant-scoping.md) ## Deliverables Checklist - [ ] Redis cache adapter implemented - [ ] Event bus supports in-process and Kafka - [ ] Background job scheduler with asynq - [ ] Cron job support - [ ] Multi-tenancy resolver and middleware - [ ] Database queries scoped by tenant ## Acceptance Criteria - Cache operations work with Redis fallback - Events can be published to Kafka - Background jobs can be scheduled - Cron jobs run on schedule - Tenant isolation works for database queries - Middleware extracts tenant from request