Skip to content

Commit

Permalink
fix: Update default prefix separator
Browse files Browse the repository at this point in the history
  • Loading branch information
yaraslau-kavaliou committed Jul 8, 2024
1 parent 1efb456 commit ed870cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion common/persistence/class.PhpRedisDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class common_persistence_PhpRedisDriver implements common_persistence_AdvKvDrive
public const DEFAULT_TIMEOUT = 5; // in seconds
public const RETRY_DELAY = 500000; // Eq to 0.5s

private const DEFAULT_PREFIX_SEPARATOR = '::';
private const DEFAULT_PREFIX_SEPARATOR = ':';

/**
* @var Redis
Expand Down
10 changes: 5 additions & 5 deletions test/unit/common/persistence/PhpRedisDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function testKeyPrefixIsAddedIfPrefixIsSet()

$this->driver->set('key1', 'value');

$this->assertEquals('25::key1', $this->getLastCallKey('set'));
$this->assertEquals('25:key1', $this->getLastCallKey('set'));
}

public function testKeyPrefixHasNotDefaultSeparatorIfSeparatorIsSet()
Expand All @@ -90,7 +90,7 @@ public function testKeysHavePrefixWithoutKeyValueMode()

$this->driver->mGet(['key1', 'key2']);

$this->assertEquals(['26::key1', '26::key2'], $this->getLastCallKey('mGet'));
$this->assertEquals(['26:key1', '26:key2'], $this->getLastCallKey('mGet'));
}

public function testKeysHavePrefixWithKeyValueMode()
Expand All @@ -99,7 +99,7 @@ public function testKeysHavePrefixWithKeyValueMode()

$this->driver->mSet(['key1', 'value1', 'key2', 'value2']);

$this->assertEquals(['25::key1', 'value1', '25::key2', 'value2'], $this->getLastCallKey('mSet'));
$this->assertEquals(['25:key1', 'value1', '25:key2', 'value2'], $this->getLastCallKey('mSet'));
}

public function testKeyPrefixIsAddedToAllMethods()
Expand All @@ -123,7 +123,7 @@ public function testKeyPrefixIsAddedToAllMethods()

foreach ($methods as $method => $methodParams) {
$this->driver->$method(...$methodParams);
$this->assertEquals('25::key', $this->getLastCallKey($method));
$this->assertEquals('25:key', $this->getLastCallKey($method));
}
}

Expand All @@ -134,7 +134,7 @@ public function testKeyPrefixIsAddedForScanMethod()
$iterator = null;
$this->driver->scan($iterator, '*pattern*');

$this->assertEquals('pref::*pattern*', $this->driver->getConnection()->calls['scan'][1]);
$this->assertEquals('pref:*pattern*', $this->driver->getConnection()->calls['scan'][1]);
}

private function getLastCallKey(string $method)
Expand Down

0 comments on commit ed870cd

Please sign in to comment.