dependency-injection
Installation
SKILL.md
Dependency Injection in myfy
myfy uses constructor-based dependency injection with three scopes.
Scopes
| Scope | Lifetime | Use Case |
|---|---|---|
| SINGLETON | Application lifetime | Config, pools, services, caches |
| REQUEST | Per HTTP request | Sessions, user context, request logger |
| TASK | Per background task | Task context, job-specific state |
Provider Declaration
from myfy.core import provider, SINGLETON, REQUEST, TASK