You are here

class PhpRedis in Redis 8

Same name in this branch
  1. 8 src/Lock/PhpRedis.php \Drupal\redis\Lock\PhpRedis
  2. 8 src/Flood/PhpRedis.php \Drupal\redis\Flood\PhpRedis
  3. 8 src/Queue/PhpRedis.php \Drupal\redis\Queue\PhpRedis
  4. 8 src/Client/PhpRedis.php \Drupal\redis\Client\PhpRedis
  5. 8 src/Cache/PhpRedis.php \Drupal\redis\Cache\PhpRedis
  6. 8 src/PersistentLock/PhpRedis.php \Drupal\redis\PersistentLock\PhpRedis

PHpRedis persistent lock backend

Hierarchy

Expanded class hierarchy of PhpRedis

4 string references to 'PhpRedis'
ClientFactory::getClientInterface in src/ClientFactory.php
Lazy instantiates client proxy depending on the actual configuration.
PhpRedis::getName in src/Client/PhpRedis.php
Get underlying library name used.
RedisCacheTagsChecksum::doInvalidateTags in src/Cache/RedisCacheTagsChecksum.php
Marks cache items with any of the specified tags as invalid.
RedisTestInterfaceTrait::getRedisInterfaceEnv in tests/src/Traits/RedisTestInterfaceTrait.php
Uses an env variable to set the redis client to use for this test.

File

src/PersistentLock/PhpRedis.php, line 10

Namespace

Drupal\redis\PersistentLock
View source
class PhpRedis extends \Drupal\redis\Lock\PhpRedis {

  /**
   * Creates a PHpRedis persistent lock backend.
   */
  public function __construct(ClientFactory $factory) {

    // Do not call the parent constructor to avoid registering a shutdown
    // function that releases all the locks at the end of a request.
    $this->client = $factory
      ->getClient();

    // Set the lockId to a fixed string to make the lock ID the same across
    // multiple requests. The lock ID is used as a page token to relate all the
    // locks set during a request to each other.
    // @see \Drupal\Core\Lock\LockBackendInterface::getLockId()
    $this->lockId = 'persistent';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LockBackendAbstract::$lockId protected property Current page lock token identifier.
LockBackendAbstract::$locks protected property Existing locks for this page.
LockBackendAbstract::getLockId public function Gets the unique page token for locks. Overrides LockBackendInterface::getLockId
LockBackendAbstract::wait public function Waits a short amount of time before a second lock acquire attempt. Overrides LockBackendInterface::wait
PhpRedis::$client protected property
PhpRedis::acquire public function Acquires a lock. Overrides LockBackendInterface::acquire
PhpRedis::getKey protected function Generate a redis key name for the current lock name.
PhpRedis::lockMayBeAvailable public function Checks if a lock is available for acquiring. Overrides LockBackendInterface::lockMayBeAvailable
PhpRedis::release public function Releases the given lock. Overrides LockBackendInterface::release
PhpRedis::releaseAll public function Releases all locks for the given lock token identifier. Overrides LockBackendInterface::releaseAll
PhpRedis::__construct public function Creates a PHpRedis persistent lock backend. Overrides PhpRedis::__construct
RedisPrefixTrait::$prefix protected property
RedisPrefixTrait::getDefaultPrefix protected function Get global default prefix
RedisPrefixTrait::getPrefix protected function Get prefix
RedisPrefixTrait::setPrefix public function Set prefix