Contents
- 1. What is the Object Pool Pattern?
- 2. When does pooling make sense?
- 3. PHP 8.4 implementation
- 4. Magento: the DB connection pool (ResourceConnection)
- 5. HTTP client pool in Magento
- 6. Building your own pool: a PDF generator example
- 7. PHP request scope: why classic pooling is limited
- 8. Pool vs. Singleton vs. Factory
- 9. Testing object pools
- 10. Conclusion: when to use Object Pool in Magento
The Object Pool Pattern is one of the often overlooked Creational Patterns from the GoF catalog. The idea is simple: instead of creating and destroying an expensive object every time, you build up a stock (pool) of such objects