comparison core/lib/Drupal/Core/Lock/NullLockBackend.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Core\Lock;
4
5 /**
6 * Defines a Null lock backend.
7 *
8 * This implementation won't actually lock anything and will always succeed on
9 * lock attempts.
10 *
11 * @ingroup lock
12 */
13 class NullLockBackend implements LockBackendInterface {
14
15 /**
16 * Current page lock token identifier.
17 *
18 * @var string
19 */
20 protected $lockId;
21
22 /**
23 * {@inheritdoc}
24 */
25 public function acquire($name, $timeout = 30.0) {
26 return TRUE;
27 }
28
29 /**
30 * {@inheritdoc}
31 */
32 public function lockMayBeAvailable($name) {
33 return TRUE;
34 }
35
36 /**
37 * {@inheritdoc}
38 */
39 public function wait($name, $delay = 30) {}
40
41 /**
42 * {@inheritdoc}
43 */
44 public function release($name) {}
45
46 /**
47 * {@inheritdoc}
48 */
49 public function releaseAll($lock_id = NULL) {}
50
51 /**
52 * {@inheritdoc}
53 */
54 public function getLockId() {
55 if (!isset($this->lockId)) {
56 $this->lockId = uniqid(mt_rand(), TRUE);
57 }
58 return $this->lockId;
59 }
60
61 }