You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: features/README.md
+8-4
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@
6
6
7
7
[`withContactPoints()`](http://datastax.github.io/php-driver/api/class/Cassandra/Cluster/Builder/#with-contact-points) and [`withPort()`](http://datastax.github.io/php-driver/api/class/Cassandra/Cluster/Builder/#with-port) methods of the [`Cassandra\Cluster\Builder`](http://datastax.github.io/php-driver/api/class/Cassandra/Cluster/Builder/) are used to specify ip addresses or hostnames and port number of the nodes in a given Cassandra cluster.
8
8
9
+
Note that you don't have to specify the addresses of all hosts in your cluster. Once the driver has established a connection to any host, it will perform auto-discovery of and connect to all hosts in the cluster.
10
+
9
11
```php
10
12
<?php
11
13
@@ -22,7 +24,7 @@ After the initial connection to one of the hosts specified via `withContactPoint
22
24
23
25
### Persistent sessions
24
26
25
-
In order to limit the startup time and total number of connections to a Cassandra cluster, the PHP Driver enabled persistent sessions by default. All cluster and sessions using the same initial configuration will be shared across requests when persistent sessions are enabled. You can toggle this setting using [`Cassandra\Cluster\Builder::withPersistentSessions()`](http://datastax.github.io/php-driver/api/class/Cassandra/Cluster/Builder/#with-persistent-sessions).
27
+
In order to limit the startup time and total number of connections to a Cassandra cluster, the PHP Driver enables persistent sessions by default. All cluster and sessions using the same initial configuration will be shared across requests when persistent sessions are enabled. You can toggle this setting using [`Cassandra\Cluster\Builder::withPersistentSessions()`](http://datastax.github.io/php-driver/api/class/Cassandra/Cluster/Builder/#with-persistent-sessions).
Note that disabling persistent sessions will cause significant slow down of cluster initialization as the connections will be forced to get re-established for every request.
38
+
Note that disabling persistent sessions will cause a significant slow down of cluster initialization as the connections will be forced to get re-established for every request.
37
39
38
40
Once persistent sessions are enabled, you can view how many of them are currently active. They will be exposed in the Cassandra extension section of `phpinfo()`.
39
41
42
+
Persistent sessions stay alive for the duration of the parent process, typically a php-fpm worker or apache worker. These sessions will be reused for all requests served by that worker process. Once a worker process has reached its end of life, sessions will get cleaned up automatically and will be re-create in the new process.
43
+
40
44
### Configuring load balancing policy
41
45
42
46
PHP Driver comes with a variety of load balancing policies. By default it uses a combination of token aware data center round robin.
@@ -135,7 +139,7 @@ $session->execute(
135
139
);
136
140
```
137
141
138
-
If you find yourself doing this often, it's better to use prepared statements. As a rule of thumb, if your application is sending a request more than once, a prepared statement is almost always the right choice.
142
+
For frequently executed queries, it's strongly recommended to use prepared statements. As a rule of thumb, if your application is sending a request more than once, a prepared statement is almost always the right choice.
139
143
140
144
### Prepared Statements
141
145
@@ -289,7 +293,7 @@ while ($result) {
289
293
290
294
### Consistency
291
295
292
-
You can specify the default consistency to use when you create a new `Cassandra\Cluster`:
296
+
You can specify the default consistency to use for statements execution when you create a new `Cassandra\Cluster`:
0 commit comments