w3resource

Redis Server: LASTSAVE

Redis LASTSAVE Command

Redis LASTSAVE command returns the UNIX TIME of the last DB save executed with success. A client may check if a BGSAVE command succeeded reading the LASTSAVE value, then issuing a BGSAVE command and checking at regular intervals every N seconds if LASTSAVE changed.

Here are some common uses and scenarios for the "LASTSAVE" command:

  • Last Save Time: Returns the Unix timestamp of the last successful save to disk, indicating when the dataset was last persisted.
  • Backup Verification: Useful for verifying the most recent backup or snapshot to ensure data recovery points are up-to-date.
  • Troubleshooting: Helps in troubleshooting by providing information about the timing of the last data persistence, aiding in identifying issues related to data loss.
  • Monitoring: Assists in monitoring data persistence activities and understanding the frequency of disk saves.

Syntax:

LASTSAVE

Available since

1.0.0.

Return Value

Integer replies a UNIX time stamp.

Return Value Type

Integer

Example: Redis LASTSAVE

redis 127.0.0.1:6379> LASTSAVE 
(integer) 1410853592

Previous: INFO
Next: MONITOR



Follow us on Facebook and Twitter for latest update.