save() public method

public save ( integer | string $keyName = null, string $content = null, integer $lifetime = null, boolean $stopBuffer = true ) : boolean
$keyName integer | string
$content string
$lifetime integer
$stopBuffer boolean
return boolean
Beispiel #1
0
 public function testShouldUseOutputFrontend()
 {
     $time = date('H:i:s');
     $frontCache = new CacheOutput(['lifetime' => 10]);
     $cache = new CacheAerospike($frontCache, $this->getConfig());
     ob_start();
     $content = $cache->start('test-output');
     $this->keys[] = 'test-output';
     $this->assertNull($content);
     echo $time;
     $obContent = ob_get_contents();
     $cache->save(null, null, null, true);
     ob_end_clean();
     $this->assertEquals($time, $obContent);
     $this->assertEquals($time, $cache->get('test-output'));
     $content = $cache->start('test-output');
     $this->assertEquals($content, $obContent);
     $this->assertEquals($content, $cache->get('test-output'));
     $keys = $cache->queryKeys();
     $this->assertEquals([0 => 'test-output'], $keys);
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  *
  * @param string $sessionId Session variable name
  * @param string $data      Session data
  */
 public function write($sessionId, $data)
 {
     return $this->db->save($sessionId, $data, $this->lifetime);
 }