Available since: 1.0.0
Time complexity: O(1)
Instruct Redis to start an Append Only File rewrite process. The rewrite will create a small optimized version of the current Append Only File.
BGREWRITEAOF fails, no data gets lost as the old AOF will be untouched.
The rewrite will be only triggered by Redis if there is not already a background process doing persistence.
BGREWRITEAOFwill still return an positive status reply, but with an appropriate message. You can check if an AOF rewrite is scheduled looking at the
INFOcommand as of Redis 2.6 or successive versions.
Since Redis 2.4 the AOF rewrite is automatically triggered by Redis, however the
BGREWRITEAOF command can be used to trigger a rewrite at any time.
Please refer to the persistence documentation for detailed information.
Simple string reply: A simple string reply indicating that the rewriting started or is about to start ASAP, when the call is executed with success.
The command may reply with an error in certain cases, as documented above.