Skip to main content
Documentation
API Reference
Search
⌘K
Ask AI
⌘I
Discord
Blog
Twitter
Console
Redis
/
/
SDKs
/
Typescript
/
Commands
/
String
GETSET
Return the value of the specified key and replace it with a new value.
1 min read
Copy as Markdown
Arguments
#
key
string
required
#
The key to get.
newValue
required
#
The new value to store.
Response
#
GETRANGE
INCR
Example
const
oldValue
=
await
redis.
getset
(
"key"
, newValue);