Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

LASTSAVE

Last updated
LASTSAVE
Group
Server
Complexity
O(1)
Arity
1 (exactly, counting the command name)
Flags
read-only, fast
HotKV Cloud
All plans
On-Premise
no license needed

LASTSAVE returns when the last snapshot was successfully written, by SAVE, BGSAVE, a save point or a shutdown. Before the first save it returns the time the server started.

A common way to confirm a background save finished is to read LASTSAVE, run BGSAVE, and poll LASTSAVE until it changes.

An integer: Unix time in seconds, in RESP2 and RESP3.

127.0.0.1:6379> LASTSAVE
(integer) 1789996400
127.0.0.1:6379> BGSAVE
Background saving started
127.0.0.1:6379> LASTSAVE
(integer) 1790000000

Same as Redis 7 and Valkey 8.

BGSAVE, SAVE, INFO