Skip to content

Commit 66ccdcc

Browse files
committed
Revert "More lib specific lock prefix (#59)"
1 parent 3fd576b commit 66ccdcc

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/mutex/SpinlockMutex.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
abstract class SpinlockMutex extends LockMutex
1818
{
1919
/** The prefix for the lock key. */
20-
private const PREFIX = 'php-malkusch-lock:';
20+
private const PREFIX = 'lock_';
2121

2222
/** @var float The timeout in seconds a lock may live */
2323
private $timeout;

tests/mutex/MemcachedMutexTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testFailAcquireLock(): void
4343

4444
$this->memcached->expects(self::atLeastOnce())
4545
->method('add')
46-
->with('php-malkusch-lock:test', true, 2)
46+
->with('lock_test', true, 2)
4747
->willReturn(false);
4848

4949
$this->mutex->synchronized(static function (): void {
@@ -60,12 +60,12 @@ public function testFailReleasingLock(): void
6060

6161
$this->memcached->expects(self::once())
6262
->method('add')
63-
->with('php-malkusch-lock:test', true, 2)
63+
->with('lock_test', true, 2)
6464
->willReturn(true);
6565

6666
$this->memcached->expects(self::once())
6767
->method('delete')
68-
->with('php-malkusch-lock:test')
68+
->with('lock_test')
6969
->willReturn(false);
7070

7171
$this->mutex->synchronized(static function (): void {});

tests/mutex/PredisMutexTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function testAddFailsToSetKey(): void
6262
{
6363
$this->client->expects(self::atLeastOnce())
6464
->method('set')
65-
->with('php-malkusch-lock:test', self::isType('string'), 'PX', 3500, 'NX')
65+
->with('lock_test', self::isType('string'), 'PX', 3500, 'NX')
6666
->willReturn(null);
6767

6868
$this->logger->expects(self::never())
@@ -84,7 +84,7 @@ public function testAddErrors(): void
8484
{
8585
$this->client->expects(self::atLeastOnce())
8686
->method('set')
87-
->with('php-malkusch-lock:test', self::isType('string'), 'PX', 3500, 'NX')
87+
->with('lock_test', self::isType('string'), 'PX', 3500, 'NX')
8888
->willThrowException($this->createMock(PredisException::class));
8989

9090
$this->logger->expects(self::once())
@@ -104,12 +104,12 @@ public function testWorksNormally(): void
104104
{
105105
$this->client->expects(self::atLeastOnce())
106106
->method('set')
107-
->with('php-malkusch-lock:test', self::isType('string'), 'PX', 3500, 'NX')
107+
->with('lock_test', self::isType('string'), 'PX', 3500, 'NX')
108108
->willReturnSelf();
109109

110110
$this->client->expects(self::once())
111111
->method('eval')
112-
->with(self::anything(), 1, 'php-malkusch-lock:test', self::isType('string'))
112+
->with(self::anything(), 1, 'lock_test', self::isType('string'))
113113
->willReturn(true);
114114

115115
$executed = false;
@@ -128,12 +128,12 @@ public function testEvalScriptFails(): void
128128
{
129129
$this->client->expects(self::atLeastOnce())
130130
->method('set')
131-
->with('php-malkusch-lock:test', self::isType('string'), 'PX', 3500, 'NX')
131+
->with('lock_test', self::isType('string'), 'PX', 3500, 'NX')
132132
->willReturnSelf();
133133

134134
$this->client->expects(self::once())
135135
->method('eval')
136-
->with(self::anything(), 1, 'php-malkusch-lock:test', self::isType('string'))
136+
->with(self::anything(), 1, 'lock_test', self::isType('string'))
137137
->willThrowException($this->createMock(PredisException::class));
138138

139139
$this->logger->expects(self::once())

0 commit comments

Comments
 (0)