Skip to content

Commit 6ecd555

Browse files
authored
Example for setting TTL to "HSET Field"
would make sense to have an example here.
1 parent 8dad79f commit 6ecd555

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

examples/ttl.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ async function main() {
2525

2626
await redis.persist("foo"); // Remove the existing timeout on key "foo"
2727
console.log(await redis.ttl("foo")); // -1
28+
29+
await redis.hset("foo", "bar", "foobar");
30+
await redis.hexpire("foo", 10, "FIELDS", 1, "bar"); // Add TTL to hset field
2831
}
2932

3033
main();

0 commit comments

Comments
 (0)