Created
September 4, 2012 20:40
-
-
Save bryanhirsch/3626207 to your computer and use it in GitHub Desktop.
Use persistent database connection by default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/mongodb.module b/mongodb.module | |
index c5e4afa..35b4527 100644 | |
--- a/mongodb.module | |
+++ b/mongodb.module | |
@@ -31,6 +31,9 @@ function mongodb($alias = 'default') { | |
$db = $connection['db']; | |
if (!isset($mongo_objects[$host][$db])) { | |
try { | |
+ $options = variable_get('mongodb_options', array()) + array( | |
+ 'persist' => '1', // Use persistent connection by default. | |
+ ); | |
$mongo = new Mongo($host, $options); | |
$mongo_objects[$host][$db] = $mongo->selectDB($db); | |
$mongo_objects[$host][$db]->connection = $mongo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment