I suggest using a shared pool
This is very understandable and quite simple, you determine how to open the connection, how to close and the pool size. The module takes care of the rest, creating new connections as needed and deleting an unused connection after a timeout, which you also select.
I use the module with every resource that I need to pool, so I donβt have to worry about the custom pool API every time.
bbbonthemoon
source share