Generic resource pooling for node.js