Depending on the DI container we choose, we will have a larger or smaller number of life cycles available.
The more common life cycles are as following:
- Transient: The object instance will exist in memory at the time it exists in the code block it is contained in
- Singleton: The object instance exists in memory until it is released explicitly
- Per request: The object instance exists in memory at the time of the HTTP request in which it is instantiated
There are lots of other life cycles avaliable, depending on the DI container we choose.