Exemple #1
0
 protected function write()
 {
     $data = $this->serializer->serialize($this->data);
     if ($this->options->getBoolean('lazy_write', false) && $this->handler instanceof LazyWriteHandlerInterface && md5($data) === $this->dataHash) {
         $this->handler->updateTimestamp($this->id, $data);
     } else {
         $this->handler->write($this->id, $data);
     }
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function save()
 {
     if (!$this->started || $this->closed) {
         throw new \RuntimeException('Trying to save a session that was not started yet or was already closed');
     }
     $data = $this->serializer->serialize($this->data);
     $this->handler->write($this->id, $data);
     $this->handler->close();
     $this->closed = true;
     $this->started = false;
 }