This adapter store sessions in Aerospike use Phalcon\Session\Adapter\Aerospike as AerospikeSession; $session = new AerospikeSession([ 'hosts' => [ ['addr' => '127.0.0.1', 'port' => 3000] ], 'persistent' => true, 'namespace' => 'test', 'prefix' => 'session_', 'lifetime' => 8600, 'uniqueId' => '3Hf90KdjQ18', 'options' => [ \Aerospike::OPT_CONNECT_TIMEOUT => 1250, \Aerospike::OPT_WRITE_TIMEOUT => 1500 ] ]); $session->start(); $session->set('var', 'some-value'); echo $session->get('var');
Inheritance: extends Phalcon\Session\Adapter, implements Phalcon\Session\AdapterInterface
Beispiel #1
0
 public function testShouldDestroySession()
 {
     $sessionId = 'abcdef123457';
     $session = new SessionHandler($this->getConfig());
     $data = serialize(['abc' => 345, 'def' => ['foo' => 'bar'], 'zyx' => 'xyz']);
     $this->tester->haveInAerospike($sessionId, base64_encode($data));
     $session->destroy($sessionId);
     $this->tester->dontSeeInAerospike($sessionId);
 }
Beispiel #2
0
 /**
  * Generates a unique key used for storing session data in Aerospike DB.
  *
  * @param string $sessionId Session variable name
  * @return array
  */
 protected function buildKey($sessionId)
 {
     return $this->db->initKey($this->namespace, $this->set, $this->prefix . $sessionId);
 }