Skip to main content

GETSET

Note

Official reference: GETSET.

Replace a string and return its previous value.

Syntax

GETSET key value

A missing key returns one row with a null VALUE.

New code can use SET ... GET, with expiration options when needed.

Results

ReturnRowsContent
ResultSet1VALUE field, STRING type

Example

SET demo:message hello
GETSET demo:message world