Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SaveHandler.php
Go to the documentation of this file.
1 <?php
7 
9 use \Magento\Framework\Exception\SessionException;
10 
15 {
22 
30  public function __construct(
31  SaveHandlerFactory $saveHandlerFactory,
32  ConfigInterface $sessionConfig,
33  $default = self::DEFAULT_HANDLER
34  ) {
41  $saveMethod = $sessionConfig->getOption('session.save_handler') ?: $default;
42 
43  try {
44  $this->saveHandlerAdapter = $saveHandlerFactory->create($saveMethod);
45  } catch (SessionException $e) {
46  $this->saveHandlerAdapter = $saveHandlerFactory->create($default);
47  }
48  }
49 
57  public function open($savePath, $name)
58  {
59  return $this->saveHandlerAdapter->open($savePath, $name);
60  }
61 
67  public function close()
68  {
69  return $this->saveHandlerAdapter->close();
70  }
71 
78  public function read($sessionId)
79  {
80  return $this->saveHandlerAdapter->read($sessionId);
81  }
82 
90  public function write($sessionId, $data)
91  {
92  return $this->saveHandlerAdapter->write($sessionId, $data);
93  }
94 
101  public function destroy($sessionId)
102  {
103  return $this->saveHandlerAdapter->destroy($sessionId);
104  }
105 
114  public function gc($maxLifetime)
115  {
116  return $this->saveHandlerAdapter->gc($maxLifetime);
117  }
118 }
__construct(SaveHandlerFactory $saveHandlerFactory, ConfigInterface $sessionConfig, $default=self::DEFAULT_HANDLER)
Definition: SaveHandler.php:30
if(!isset($_GET['name'])) $name
Definition: log.php:14