Skip to content

Commit 89afaf8

Browse files
author
Bulat Shakirzyanov
committed
update docs based on feedback
1 parent 1c838f8 commit 89afaf8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

features/README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
[`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.
88

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+
911
```php
1012
<?php
1113

@@ -22,7 +24,7 @@ After the initial connection to one of the hosts specified via `withContactPoint
2224

2325
### Persistent sessions
2426

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).
2628

2729
```php
2830
<?php
@@ -33,10 +35,12 @@ $cluster = Cassandra::cluster()
3335
$session = $cluster->connect();
3436
```
3537

36-
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.
3739

3840
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()`.
3941

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+
4044
### Configuring load balancing policy
4145

4246
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(
135139
);
136140
```
137141

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.
139143

140144
### Prepared Statements
141145

@@ -289,7 +293,7 @@ while ($result) {
289293

290294
### Consistency
291295

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`:
293297

294298
```php
295299
<?php

0 commit comments

Comments
 (0)