-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add support for SET with KEEPTTL #1517
Comments
@martinzuern Works without changes - |
@stockholmux How do you provide the options to the set command? I could not find this information in the documentation |
client.set('key', 'value', 'KEEPTTL', (err, reply) => {
// ...
}); |
Thank you @leibale , how do you apply multiple option instead? |
client.set('key', 'value', 'EX', '10', 'NX', 'GET', (err, reply) => {
// ...
}); edit: NX & GET are not supported by Redis (try to run it in |
I already tried that, I still get
I'm using redis 3.0.2 btw. Is that supported on this version? Ah thanks for the clarification, it does not seem to be documented on the website https://redis.io/commands/set |
Works like a charm 👌 |
Why is this closed ? you still can't do something like this
|
Hey @iimanii Have you found a work around to pass both options |
client.set('key', 'value', 'KEEPTTL', 'XX', (err, reply) => {
// ...
}); |
Thanks that's awesome @leibale. Are you aware of this type missing in the @types/redis package? |
@isidoro98 |
Awesome, thanks for letting me know! Wasn't aware of that :) |
my code with export async function updateObject<T>(key: string, item: T) {
return redis.set(key, JSON.stringify(item), 'KEEPTTL', 'XX');
}
export async function setObject<T>(key: string, item: T) {
return redis.set(key, JSON.stringify(item), 'EX', 3600);
} |
For the next person who ends up here. I'm on
|
Issue
Redis 6 introduced support for the
KEEPTTL
flag when usingSET
.https://redis.io/commands/set
The text was updated successfully, but these errors were encountered: