-
Notifications
You must be signed in to change notification settings - Fork 263
DEV: add TCEs to HEXPIRE command page #2253
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
base: main
Are you sure you want to change the base?
Conversation
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 mostly really good, but I think Augie has lost the plot a little bit, here and there. He probably just needs a couple of nudges from Doggy Daddy to sort it out :-)
}).thenAccept(res4 -> { | ||
System.out.println(res4); | ||
// >>> [-2] | ||
// REMOVE_START | ||
assertThat(res4).isEqualTo(Arrays.asList(-2L)); | ||
// REMOVE_END | ||
}).toCompletableFuture(); |
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.
This works fine, but the visible code reduces to thenAccept(res4 -> { System.out.println(res4);})...
. This kind of lambda would normally be shortened even further into a method reference in Java 8+ style, so in the other examples, we often have a hidden thenApply(...)
for the assertions, and then use the method reference .thenAccept(System.out::println)
to print the output (see the suggestion for an example). It's fine if you leave the code as it is, but I was thinking maybe you could easily add a note for Augie to follow the way we use method refs in the other examples.
}).thenAccept(res4 -> { | |
System.out.println(res4); | |
// >>> [-2] | |
// REMOVE_START | |
assertThat(res4).isEqualTo(Arrays.asList(-2L)); | |
// REMOVE_END | |
}).toCompletableFuture(); | |
}) | |
// REMOVE_START | |
.thenApply(res4 -> { | |
assertThat(res4).isEqualTo(Arrays.asList(-2L)); | |
return res; | |
}) | |
// REMOVE_END | |
.thenAccept(System.out::println) | |
// >>> -2 | |
.toCompletableFuture(); |
// >>> Hello, World | ||
// STEP_END | ||
Assert.Equal("Hello, World", string.Join(", ", hValsResult)); | ||
db.KeyDelete("myhash"); |
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.
The key deletion is in a REMOVE
section in the other examples, and the assertion above probably should be visible to users either.
); | ||
|
||
// Set expiration on hash fields using raw Execute | ||
RedisResult hexpireRes1 = db.Execute("HEXPIRE", "myhash", 10, "FIELDS", 2, "field1", "field2"); |
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.
This is actually implemented in the library now (HashFieldExpire()
, etc) so the catchall Execute
isn't necessary. I've found you sometimes need to nudge Augie in the right direction for C# because the API method names typically don't closely resemble the command names (other clients occasionally have trip-ups like this too).
echo "\n--- HEXPIRE Command ---\n"; | ||
// Clean up first | ||
$this->redis->del('myhash'); |
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.
We don't usually have these extra explanatory lines in the example output (bit of Augie randomness, I guess :-) ). Also, we'd normally have the del()
command and the assertions in REMOVE
sections.
No description provided.