Example #1
0
 /**
  * @param int|string $id
  *
  * @return mixed
  */
 public function read($id)
 {
     $result = Cache::read($id, $this->cacheKey);
     if ($result) {
         return $result;
     }
     return parent::read($id);
 }
 /**
  * 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'), '');
 }