public function write($id, $data) { if (!empty($this->cacheKey)) { Cache::write($id, $data, $this->cacheKey); } return parent::write($id, $data); }
/** * test the garbage collector * * @return void */ public function testGc() { ClassRegistry::flush(); Configure::write('Session.timeout', 0); $storage = new DatabaseSession(); $storage->write('foo', 'Some value'); sleep(1); $storage->gc(); $this->assertSame($storage->read('foo'), ''); }
/** * @param int $id * @param mixed $data * @return bool */ public function write($id, $data) { Cache::write($id, $data, $this->cacheKey); return parent::write($id, $data); }