Example #1
0
 /**
  * Try to connect to the cache server and make read/write operations
  */
 public function testCacheAccess()
 {
     $cc = new Redis($this->settings);
     $this->assertEquals(null, $cc->getData('tests-' . $this->session . '-string'));
     $cc->setData('tests-' . $this->session . '-string', 'this is a simple string');
     $this->assertEquals('this is a simple string', $cc->getData('tests-' . $this->session . '-string'));
     $cc->setData('tests-' . $this->session . '-int', 3);
     $this->assertEquals(3, $cc->getData('tests-' . $this->session . '-int'));
     $cc->setData('tests-' . $this->session . '-float', 3.3);
     $this->assertEquals(3.3, $cc->getData('tests-' . $this->session . '-float'));
     $cc->setData('tests-' . $this->session . '-array', ['a', 'b']);
     $this->assertEquals(['a', 'b'], $cc->getData('tests-' . $this->session . '-array'));
 }