I have a requirement to connect to Redis and PostgreSQL databases. For performance reasons, I need to be able to connect to these databases with a connection pool. There are some packages for connection pool e.g. Redis redis-connection-pool, node-redis-connection-pool and Postgresnode-postgres. These work well individually.
How do I make them work across a Node-RED instance? Can I set-up a script that runs at Node-RED start-up which then 'exports' the pool object to any node that could 'require' it?
No, you would have to look at how the available node-red nodes for Redis and Postgres were written and then modify them if needed.
A lot of nodes already have the concept of shared config nodes which hold a connection so they may already have a point to anchor a pool.