Author: Markus Malkusch (markus@malkusch.de)
Inheritance: extends LockMutex
Example #1
0
 /**
  * Sets the Redis APIs.
  *
  * @param array  $redisAPIs The Redis APIs.
  * @param string $name      The lock name.
  * @param int    $timeout   The time in seconds a lock expires, default is 3.
  *
  * @throws \LengthException The timeout must be greater than 0.
  */
 public function __construct(array $redisAPIs, $name, $timeout = 3)
 {
     parent::__construct($name, $timeout);
     $this->redisAPIs = $redisAPIs;
     $this->logger = new NullLogger();
     $this->seedRandom();
 }
Example #2
0
 /**
  * Sets the lock's name and the connected Memcache API.
  *
  * The Memcache API needs to be connected to a server.
  * I.e. Memcache::connect() was already called.
  *
  * @param string   $name     The lock name.
  * @param Memcache $memcache The connected Memcache API.
  * @param int      $timeout  The time in seconds a lock expires, default is 3.
  *
  * @throws \LengthException The timeout must be greater than 0.
  */
 public function __construct($name, Memcache $memcache, $timeout = 3)
 {
     parent::__construct($name, $timeout);
     $this->memcache = $memcache;
 }
Example #3
0
 /**
  * Sets the lock's name and the connected Memcache API.
  *
  * The Memcache API needs to be connected to a server.
  * I.e. Memcache::connect() was already called.
  *
  * @param string   $name     The lock name.
  * @param Memcache $memcache The connected Memcache API.
  * @param int      $timeout  The time in seconds a lock expires, default is 3.
  *
  * @throws \LengthException The timeout must be greater than 0.
  */
 public function __construct($name, Memcache $memcache, $timeout = 3)
 {
     parent::__construct($name, $timeout);
     trigger_error("MemcacheMutex has been deprecated in favour of MemcachedMutex.", E_USER_DEPRECATED);
     $this->memcache = $memcache;
 }