Not sure how many tenants you plan to have in memory, but you should
probably check out some (memory) caching libraries.

Cheers,
Gus

On Tue, Jun 9, 2015 at 1:39 AM, Aria Stewart <[email protected]> wrote:

>
> > On 8 Jun 2015, at 23:38, Steve P <[email protected]> wrote:
> >
> > I'm working on a multi-tenant app in which each client will have their
> own database, each having the identical schemas and I need to be able to
> swap out the database I'm connecting to on a per request basis. I've been
> able to find nothing regarding this ability as near as I can tell the db
> connection is set at boot time.
> >
> > This is surely possible with Node, right?
>
> Yes!
>
> You're probably overthinking it: the simplest increment from 'connect at
> boot time to one database' is 'connect at boot time to all the databases,
> and pick the right connection at request time'.
>
> From there it's a small step to make that lazily connect -- if there's a
> connection, use it. If not, create it and use it.
>
> You may want to look at connection pooling libraries in the registry. They
> may help this.
>
> Aria
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/F61C93AE-BF6E-4544-9AEA-EDD37D9C7032%40dinhe.net
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAJkwh4LmFj-X4zx4CLhcAMFUWMp5xjR-wf0EZcLDKjrQNC7yaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to