-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
824 additions
and
86 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,109 @@ | ||
*8 | ||
$4 | ||
ZADD | ||
$4 | ||
zset | ||
$1 | ||
1 | ||
$3 | ||
one | ||
$1 | ||
2 | ||
$3 | ||
two | ||
$1 | ||
3 | ||
$25 | ||
{"json":{"key": "value"}} | ||
*4 | ||
$4 | ||
ZADD | ||
$4 | ||
zset | ||
$1 | ||
2 | ||
$9 | ||
two again | ||
*3 | ||
$3 | ||
SET | ||
$6 | ||
string | ||
$25 | ||
{"json":{"key": "value"}} | ||
*5 | ||
$4 | ||
SADD | ||
$3 | ||
set | ||
$3 | ||
one | ||
$3 | ||
two | ||
$25 | ||
{"json":{"key": "value"}} | ||
*5 | ||
$5 | ||
RPUSH | ||
$4 | ||
list | ||
$3 | ||
one | ||
$1 | ||
2 | ||
$25 | ||
{"json":{"key": "value"}} | ||
*4 | ||
$4 | ||
HSET | ||
$4 | ||
hash | ||
$5 | ||
field | ||
$5 | ||
value | ||
*4 | ||
$4 | ||
HSET | ||
$4 | ||
hash | ||
$4 | ||
json | ||
$25 | ||
{"json":{"key": "value"}} | ||
*8 | ||
$6 | ||
GEOADD | ||
$3 | ||
geo | ||
$9 | ||
13.361389 | ||
$9 | ||
38.115556 | ||
$7 | ||
Palermo | ||
$9 | ||
15.087269 | ||
$9 | ||
37.502669 | ||
$7 | ||
Catania | ||
*9 | ||
$5 | ||
PFADD | ||
$11 | ||
hyperLogLog | ||
$1 | ||
a | ||
$1 | ||
b | ||
$1 | ||
c | ||
$1 | ||
d | ||
$1 | ||
e | ||
$1 | ||
f | ||
$1 | ||
g |
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 |
---|---|---|
|
@@ -4,3 +4,5 @@ services: | |
image: redis:3 | ||
ports: | ||
- 6379:6379 | ||
volumes: | ||
- ./:/repo |
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
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,16 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace hollodotme\Readis\Application\ReadModel\Constants; | ||
|
||
abstract class KeyType | ||
{ | ||
public const HASH = 'hash'; | ||
|
||
public const LIST = 'list'; | ||
|
||
public const SET = 'set'; | ||
|
||
public const SORTED_SET = 'zset'; | ||
|
||
public const STRING = 'string'; | ||
} |
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,45 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace hollodotme\Readis\Application\ReadModel\DTO; | ||
|
||
use hollodotme\Readis\Application\ReadModel\Interfaces\ProvidesKeyData; | ||
|
||
final class KeyData implements ProvidesKeyData | ||
{ | ||
/** @var string */ | ||
private $keyData; | ||
|
||
/** @var string */ | ||
private $rawKeyData; | ||
|
||
/** @var null|float */ | ||
private $score; | ||
|
||
public function __construct( string $keyData, string $rawKeyData, ?float $score = null ) | ||
{ | ||
$this->keyData = $keyData; | ||
$this->rawKeyData = $rawKeyData; | ||
$this->score = $score; | ||
} | ||
|
||
public function getKeyData() : string | ||
{ | ||
return $this->keyData; | ||
} | ||
|
||
public function getRawKeyData() : string | ||
{ | ||
return $this->rawKeyData; | ||
} | ||
|
||
public function hasScore() : bool | ||
{ | ||
return (null !== $this->score); | ||
} | ||
|
||
public function getScore() : ?float | ||
{ | ||
return $this->score; | ||
} | ||
|
||
} |
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,35 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace hollodotme\Readis\Application\ReadModel\DTO; | ||
|
||
use hollodotme\Readis\Application\ReadModel\Interfaces\ProvidesKeyName; | ||
|
||
final class KeyName implements ProvidesKeyName | ||
{ | ||
/** @var string */ | ||
private $keyName; | ||
|
||
/** @var null|string */ | ||
private $subKey; | ||
|
||
public function __construct( string $keyName, ?string $subKey = null ) | ||
{ | ||
$this->keyName = $keyName; | ||
$this->subKey = $subKey; | ||
} | ||
|
||
public function getKeyName() : string | ||
{ | ||
return $this->keyName; | ||
} | ||
|
||
public function hasSubKey() : bool | ||
{ | ||
return (null !== $this->subKey); | ||
} | ||
|
||
public function getSubKey() : ?string | ||
{ | ||
return $this->subKey; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/Application/ReadModel/Interfaces/ProvidesHashKeyNames.php
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,8 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace hollodotme\Readis\Application\ReadModel\Interfaces; | ||
|
||
interface ProvidesHashKeyNames extends ProvidesKeyName | ||
{ | ||
public function getHashKeyName() : string; | ||
} |
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,14 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace hollodotme\Readis\Application\ReadModel\Interfaces; | ||
|
||
interface ProvidesKeyData | ||
{ | ||
public function getKeyData() : string; | ||
|
||
public function getRawKeyData() : string; | ||
|
||
public function hasScore() : bool; | ||
|
||
public function getScore() : ?float; | ||
} |
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,12 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace hollodotme\Readis\Application\ReadModel\Interfaces; | ||
|
||
interface ProvidesKeyName | ||
{ | ||
public function getKeyName() : string; | ||
|
||
public function hasSubKey() : bool; | ||
|
||
public function getSubKey() : ?string; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Application/ReadModel/Prettifiers/HyperLogLogPrettifier.php
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,19 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace hollodotme\Readis\Application\ReadModel\Prettifiers; | ||
|
||
use hollodotme\Readis\Application\ReadModel\Interfaces\PrettifiesString; | ||
use function stripos; | ||
|
||
final class HyperLogLogPrettifier implements PrettifiesString | ||
{ | ||
public function canPrettify( string $data ) : bool | ||
{ | ||
return (0 === stripos( $data, 'HYLL' )); | ||
} | ||
|
||
public function prettify( string $data ) : string | ||
{ | ||
return $data . "\n\n(HyperLogLog encoded value)"; | ||
} | ||
} |
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
Oops, something went wrong.