Key expiration in transactions

Assume the following commands:

① SET key value PX 1000 NX
② INCRBY key 10

If we send these two commands in pipeline mode, there has a chance that the key hasn’t expired when running the first command SET...NX (so the SET...NX command would return nil), and the key expired just before the second command INCRBY, so that the INCRBY would creat a key which is never expired.

I wonder if I using the transaction (MULTI...EXEC) instead of pipeline, is the key would expire in that transaction?

If you’ll use transaction the key can’t expire before the INCRBY will happen

1 Like

Is there any documentation for this transaction’s feature?