-
-
Notifications
You must be signed in to change notification settings - Fork 983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for hash field expiration commands #1456
base: v2.x
Are you sure you want to change the base?
Conversation
PR still on draft, until:
|
cbc69b4
to
b59f5fb
Compare
src/ClientContextInterface.php
Outdated
@@ -165,7 +175,10 @@ | |||
* @method $this hrandfield(string $key, int $count = 1, bool $withValues = false) | |||
* @method $this hscan($key, $cursor, array $options = null) | |||
* @method $this hset($key, $field, $value) | |||
* @method $this hsetf(string $key, array $keyValuePairs, HSetFArguments $arguments = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call keyValuePairs
dictionary
, like in hmset
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense
/** | ||
* Set the modifier that defines a behaviour on expiration. | ||
* | ||
* NX for each specified field set expiration only when the field has no expiration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being picky here, missing end dot at two sentences. And some more at the other method below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it
/** | ||
* @var array | ||
*/ | ||
protected $expireModifierEnum = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my mind these two don't belong together. The {NX,XX,GT,LT} set is for overwriting rules, while {EX,PX,EXAT,PXAT} are basically just parameter name in compact form. For example {NX,XX,GT,LT} applies to other hash expiration commands, while the other set does not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So something like overrideModifierEnum
sounds better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine. I think my original point was to split the class in two, but on second thought I'm not sure it's worth it.
*/ | ||
public function setPersist(): self | ||
{ | ||
if (!empty(array_intersect($this->ttlModifierEnum, $this->arguments))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if someone first calls setPersist
and then calls setTtlModifier
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, let's add the same kind of check on the other side
@@ -72,7 +72,7 @@ class MasterSlaveReplication implements ReplicationInterface | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function __construct(ReplicationStrategy $strategy = null) | |||
public function __construct(?ReplicationStrategy $strategy = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already a PR with this changes, I'm waiting for approval and then rebase this branch
@@ -72,7 +72,7 @@ class MasterSlaveReplication implements ReplicationInterface | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function __construct(ReplicationStrategy $strategy = null) | |||
public function __construct(?ReplicationStrategy $strategy = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already a PR with this changes, I'm waiting for approval and then rebase this branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I can't use the "Approve" button, but consider this approved from my side.
82eab7a
to
c522417
Compare
This PR adds new commands operates on hash field expiration functionality