w3resource

Redis Server: BGSAVE

Redis BGSAVE command

Redis BGSAVE command is used to save the DB in the background. The OK code is immediately returned. Redis forks, the parent continues to serve the clients, the child saves the DB on disk then exits.

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

  • Background Snapshot: Creates a snapshot of the dataset and saves it to disk in the background, allowing the server to continue processing requests.
  • Data Backup: Useful for creating periodic backups of the Redis database.
  • Disaster Recovery: Provides a way to recover data in case of server failure by restoring from the snapshot.
  • Data Persistence: Ensures data persistence by saving the current state of the database to disk.

Syntax:

Basic syntax of redis BGSAVE command is shown below:

BGSAVE

Available since

1.0.0.

Return Value

Simple string reply.

Return Value Type

String

Previous: BGREWRITEAOF
Next: CLIENT KILL



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/redis/redis-server-bgsave.php