Ligo George
Ligo George

Reputation: 889

PHP Cassandra Session Reuse

Today I read " Use at most one Session per keyspace, or use a single Session and explicitely specify the keyspace in your queries " here : https://www.datastax.com/dev/blog/4-simple-rules-when-using-the-datastax-drivers-for-cassandra

In my case I am connecting to cassandra from PHP and Node.js . I hope it is OK to connect from these both platforms.

In my current PHP setup I am including cassandra connection statements in every php file.

$cluster  = Cassandra::cluster()
               ->withContactPoints('127.0.0.1')
               ->build();
$session  = $cluster->connect("simplex");

$schema   = $session->schema();

For reusing the same php cassandra session, should I manually implements something or PHP-Cassandra driver will take care of it ?

PS: I am not much experienced in PHP or Cassandra.

Upvotes: 1

Views: 314

Answers (1)

Ligo George
Ligo George

Reputation: 889

Yes, I found the answer here : https://datastax.github.io/php-driver/features/sessions/persistent_sessions/.

PHP Cassandra driver uses persistent connection by default.

Upvotes: 1

Related Questions