# LASTSAVE

> Return the Unix time of the last successful snapshot save.

URL: https://docs.hotkv.com/commands/lastsave/

```
LASTSAVE
```

- Group: Server
- Complexity: O(1)
- HotKV Cloud: all plans
- On-Premise: no license needed

`LASTSAVE` returns when the last snapshot was successfully written, by
[SAVE](https://docs.hotkv.com/commands/save/index.md), [BGSAVE](https://docs.hotkv.com/commands/bgsave/index.md), 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.

## Return value

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

## Examples

```
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
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[BGSAVE](https://docs.hotkv.com/commands/bgsave/index.md), [SAVE](https://docs.hotkv.com/commands/save/index.md), [INFO](https://docs.hotkv.com/commands/info/index.md)