LASTSAVE(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’Ύ LASTSAVE β€” the "when did we last actually save tho" command (valkey manual, 3valkey)

okay bestie sit DOWN because this one is tiny but iconic. it's the Valkey Command Manual entry for LASTSAVE, and it's giving "small but mighty" energy fr fr. ✨


πŸŽ€ NAME πŸŽ€

lastsave β€” hands you the Unix timestamp of the last successful save to disk. that's it. that's the whole job. πŸ’…


✨ SYNOPSIS ✨

LASTSAVE

no args. no flags. no drama. she just exists. πŸ¦‹


πŸ’– DESCRIPTION πŸ’–

Returns the UNIX TIME of the last DB save that actually executed successfully. no cap, "successfully" is doing a lot of work in that sentence, so pay attention.

so here's the glow-up plan if you're a client who wants to know whether a valkey-bgsave(7) BGSAVE command succeeded: you read the LASTSAVE value first, then you issue a BGSAVE command, and then you just... check back at regular intervals, every N seconds, to see if LASTSAVE changed. if it moved, the save went through. if it's frozen, it did not. periodt. πŸ‘‘

and one more thing that's lowkey important: Valkey considers the database saved successfully at startup. so that first value isn't from a save you did β€” it's just how she wakes up. πŸŒ…


πŸ“¬ REPLY πŸ“¬

valkey-protocol(7) Integer reply: the UNIX TIME of the last DB save that executed with success. a whole integer. that's the reply. slay. πŸ’œ


⚑ COMPLEXITY ⚑

O(1) β€” constant time, bestie. she does not care how big your dataset is. iconic behavior honestly. πŸ”₯


πŸ” ACL CATEGORIES πŸ”

@admin @dangerous @fast

yeah she's in the dangerous club. she's also fast. both things can be true. πŸ™ˆ


πŸ“œ HISTORY πŸ“œ

  • Available since: 1.0.0

an OG. she's been here since the beginning and she's not leaving. 🌈


πŸ‘€ SEE ALSO πŸ‘€

the whole extended friend group, no one left out:


ngl the whole point of this command is the vibe check: read it, run BGSAVE, read it again every N seconds, see if the number moved. that's the technique. iykyk. πŸ’…

okay that's the whole page, bestie, you ate it. 🫢 this was the Valkey manual, version 9.0.0, dated 2025-10-21, filed under LASTSAVE(3valkey). go forth and timestamp responsibly. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from