Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15335489
D16577.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D16577.id.diff
View Options
diff --git a/src/aphront/storage/connection/AphrontDatabaseConnection.php b/src/aphront/storage/connection/AphrontDatabaseConnection.php
--- a/src/aphront/storage/connection/AphrontDatabaseConnection.php
+++ b/src/aphront/storage/connection/AphrontDatabaseConnection.php
@@ -12,6 +12,7 @@
private $queryTimeout;
private $locks = array();
private $lastActiveEpoch;
+ private $persistent;
abstract public function getInsertID();
abstract public function getAffectedRows();
@@ -21,6 +22,12 @@
abstract public function close();
abstract public function openConnection();
+ public function __destruct() {
+ // NOTE: This does not actually close persistent connections: PHP maintains
+ // them in the connection pool.
+ $this->close();
+ }
+
final public function setLastActiveEpoch($epoch) {
$this->lastActiveEpoch = $epoch;
return $this;
@@ -30,6 +37,15 @@
return $this->lastActiveEpoch;
}
+ final public function setPersistent($persistent) {
+ $this->persistent = $persistent;
+ return $this;
+ }
+
+ final public function getPersistent() {
+ return $this->persistent;
+ }
+
public function queryData($pattern/* , $arg, $arg, ... */) {
$args = func_get_args();
array_unshift($args, $this);
diff --git a/src/aphront/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php b/src/aphront/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php
--- a/src/aphront/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php
+++ b/src/aphront/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php
@@ -59,6 +59,10 @@
$conn->options(MYSQLI_OPT_CONNECT_TIMEOUT, $timeout);
}
+ if ($this->getPersistent()) {
+ $host = 'p:'.$host;
+ }
+
@$conn->real_connect(
$host,
$user,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 9, 3:52 PM (2 w, 22 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7389601
Default Alt Text
D16577.id.diff (1 KB)
Attached To
Mode
D16577: Support persistent connections in libphutil
Attached
Detach File
Event Timeline
Log In to Comment