Skip to content

Instantly share code, notes, and snippets.

@twidi
Created April 1, 2010 15:55
Show Gist options
  • Save twidi/351975 to your computer and use it in GitHub Desktop.
Save twidi/351975 to your computer and use it in GitHub Desktop.
index 1c0e8fa..23b0d4a 100644
--- a/redis/client.py
+++ b/redis/client.py
@@ -213,6 +213,7 @@ class Redis(threading.local):
string_keys_to_dict('ZRANGE ZRANGEBYSCORE ZREVRANGE', zset_score_pairs),
{
'BGSAVE': lambda r: r == 'Background saving started',
+ 'BGREWRITEAOF': lambda r: r == 'Background rewriting of AOF file started',
'HGETALL': lambda r: r and pairs_to_dict(r) or None,
'INFO': parse_info,
'LASTSAVE': timestamp_to_datetime,
@@ -419,6 +420,12 @@ class Redis(threading.local):
"""
return self.execute_command('BGSAVE')
+ def bgrewriteaof(self):
+ """
+ Tell the Redis server to rewrite the AOF file from data in memory.
+ """
+ return self.execute_command('BGREWRITEAOF')
+
def dbsize(self):
"Returns the number of keys in the current database"
return self.execute_command('DBSIZE')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment