-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include every "length" command + generic way to set typed keys (#96)
* Relay caches in-memory the "length" information about keys of any type, so we should include all of these commands in our benchmark suite. * Add a generic helper method that uses our flags to set keys of a given type in a generic way.
- Loading branch information
1 parent
40132f2
commit 93913cb
Showing
7 changed files
with
117 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace CacheWerk\Relay\Benchmarks\Cases; | ||
|
||
use CacheWerk\Relay\Benchmarks\Support\BenchmarkLenCommand; | ||
|
||
class BenchmarkHLEN extends BenchmarkLenCommand | ||
{ | ||
public static function flags(): int | ||
{ | ||
return self::HASH | self::READ; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace CacheWerk\Relay\Benchmarks\Cases; | ||
|
||
use CacheWerk\Relay\Benchmarks\Support\BenchmarkLenCommand; | ||
|
||
class BenchmarkLLEN extends BenchmarkLenCommand | ||
{ | ||
public static function flags(): int | ||
{ | ||
return self::LIST | self::READ; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace CacheWerk\Relay\Benchmarks\Cases; | ||
|
||
use CacheWerk\Relay\Benchmarks\Support\BenchmarkLenCommand; | ||
|
||
class BenchmarkSTRLEN extends BenchmarkLenCommand | ||
{ | ||
public static function flags(): int | ||
{ | ||
return self::STRING | self::READ; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace CacheWerk\Relay\Benchmarks\Cases; | ||
|
||
use CacheWerk\Relay\Benchmarks\Support\BenchmarkLenCommand; | ||
|
||
class BenchmarkZCARD extends BenchmarkLenCommand | ||
{ | ||
public static function flags(): int | ||
{ | ||
return self::ZSET | self::READ; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace CacheWerk\Relay\Benchmarks\Support; | ||
|
||
use CacheWerk\Relay\Benchmarks\Support\BenchmarkKeyCommand; | ||
|
||
abstract class BenchmarkLenCommand extends BenchmarkKeyCommand | ||
{ | ||
/** | ||
* @var array<int, string> | ||
*/ | ||
protected array $keys; | ||
|
||
public function setUp(): void | ||
{ | ||
$this->flush(); | ||
$this->setUpClients(); | ||
$this->seed(); | ||
} | ||
|
||
public function seed(): void | ||
{ | ||
$this->keys = $this->seedSimpleKeys(); | ||
} | ||
} |