From: Tom Sawyer Date: 2002-07-13T08:40:10+09:00 Subject: Re: cache dbi for web app hey dave, i am using mod_ruby. just to be clear, using the cgi module dosen't inhibit mod_ruby in any way right? also, what about extensions. my main script is .rbx, per mod_ruby, but it requires other scripts that are just .rb. how does that effect it? and finally... > db ||= DBI.connect(...) how does this work? thanks, tom On Fri, 2002-07-12 at 15:51, Dave Thomas wrote: > Tom Sawyer writes: > > > but my web app is dog slow. one of the reasons is that i connect to the > > database on every request. is there a way to persist a database > > connection between requests? > > Switching to mod_ruby would help a lot, both removing the interpreter > start-up time and giving you a persistent database connection. > > For the connection, something as simple as > > db ||= DBI.connect(...) > > at the start of the script will work fine until you want to get > sophisticated and do things like reconnect after database shutdowns > and the like. > > > Cheers > > > Dave > -- ~transami __("< berk! berk! \__/ ^^