Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
Redis Class Reference
Inheritance diagram for Redis:

Public Member Functions

 __construct (ConfigInterface $config, LoggerInterface $logger, Filesystem $filesystem)
 
 open ($savePath, $sessionName)
 
 read ($sessionId)
 
 write ($sessionId, $sessionData)
 
 destroy ($sessionId)
 
 close ()
 
 gc ($maxLifeTime)
 
 getFailedLockAttempts ()
 

Detailed Description

Definition at line 17 of file Redis.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( ConfigInterface  $config,
LoggerInterface  $logger,
Filesystem  $filesystem 
)
Parameters
ConfigInterface$config
LoggerInterface$logger
Filesystem$filesystem
Exceptions
SessionException

Definition at line 45 of file Redis.php.

46  {
47  $this->config = $config;
48  $this->logger = $logger;
49  $this->filesystem = $filesystem;
50  }
$config
Definition: fraud_order.php:17
$logger
$filesystem

Member Function Documentation

◆ close()

close ( )

Overridden to prevent calling getLifeTime at shutdown

Returns
bool
Exceptions
SessionException

Definition at line 132 of file Redis.php.

133  {
134  return $this->getConnection()->close();
135  }

◆ destroy()

destroy (   $sessionId)

Destroy session

Parameters
string$sessionId
Returns
boolean
Exceptions
SessionException

Definition at line 121 of file Redis.php.

122  {
123  return $this->getConnection()->destroy($sessionId);
124  }

◆ gc()

gc (   $maxLifeTime)

Garbage collection

Parameters
int$maxLifeTimeignored
Returns
boolean
Exceptions
SessionException@SuppressWarnings(PHPMD.ShortMethodName)

Definition at line 145 of file Redis.php.

146  {
147  return $this->getConnection()->gc($maxLifeTime);
148  }

◆ getFailedLockAttempts()

getFailedLockAttempts ( )

Get the number of failed lock attempts

Returns
int
Exceptions
SessionException

Definition at line 156 of file Redis.php.

157  {
158  return $this->getConnection()->getFailedLockAttempts();
159  }

◆ open()

open (   $savePath,
  $sessionName 
)

Open session

Parameters
string$savePathignored
string$sessionNameignored
Returns
bool
Exceptions
SessionException

Definition at line 79 of file Redis.php.

80  {
81  return $this->getConnection()->open($savePath, $sessionName);
82  }

◆ read()

read (   $sessionId)

Fetch session data

Parameters
string$sessionId
Returns
string
Exceptions
ConcurrentConnectionsExceededException
SessionException

Definition at line 92 of file Redis.php.

93  {
94  try {
95  return $this->getConnection()->read($sessionId);
96  } catch (ConcurrentConnectionsExceededException $e) {
97  require $this->filesystem->getDirectoryRead(DirectoryList::PUB)->getAbsolutePath('errors/503.php');
98  }
99  }

◆ write()

write (   $sessionId,
  $sessionData 
)

Update session

Parameters
string$sessionId
string$sessionData
Returns
boolean
Exceptions
SessionException

Definition at line 109 of file Redis.php.

110  {
111  return $this->getConnection()->write($sessionId, $sessionData);
112  }

The documentation for this class was generated from the following file: