Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mutex/SpinlockMutex.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
abstract class SpinlockMutex extends LockMutex
{
/** The prefix for the lock key. */
private const PREFIX = 'lock_';
private const PREFIX = 'php-malkusch-lock:';

/** @var float The timeout in seconds a lock may live */
private $timeout;
Expand Down
6 changes: 3 additions & 3 deletions tests/mutex/MemcachedMutexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testFailAcquireLock(): void

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

$this->mutex->synchronized(static function (): void {
Expand All @@ -56,12 +56,12 @@ public function testFailReleasingLock(): void

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

$this->memcached->expects(self::once())
->method('delete')
->with('lock_test')
->with('php-malkusch-lock:test')
->willReturn(false);

$this->mutex->synchronized(static function (): void {});
Expand Down
12 changes: 6 additions & 6 deletions tests/mutex/PredisMutexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function testAddFailsToSetKey(): void
{
$this->client->expects(self::atLeastOnce())
->method('set')
->with('lock_test', self::isType('string'), 'PX', 3500, 'NX')
->with('php-malkusch-lock:test', self::isType('string'), 'PX', 3500, 'NX')
->willReturn(null);

$this->logger->expects(self::never())
Expand All @@ -72,7 +72,7 @@ public function testAddErrors(): void
{
$this->client->expects(self::atLeastOnce())
->method('set')
->with('lock_test', self::isType('string'), 'PX', 3500, 'NX')
->with('php-malkusch-lock:test', self::isType('string'), 'PX', 3500, 'NX')
->willThrowException($this->createMock(PredisException::class));

$this->logger->expects(self::once())
Expand All @@ -92,12 +92,12 @@ public function testWorksNormally(): void
{
$this->client->expects(self::atLeastOnce())
->method('set')
->with('lock_test', self::isType('string'), 'PX', 3500, 'NX')
->with('php-malkusch-lock:test', self::isType('string'), 'PX', 3500, 'NX')
->willReturnSelf();

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

$executed = false;
Expand All @@ -116,12 +116,12 @@ public function testEvalScriptFails(): void
{
$this->client->expects(self::atLeastOnce())
->method('set')
->with('lock_test', self::isType('string'), 'PX', 3500, 'NX')
->with('php-malkusch-lock:test', self::isType('string'), 'PX', 3500, 'NX')
->willReturnSelf();

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

$this->logger->expects(self::once())
Expand Down
Loading