Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jperras/268801 to your computer and use it in GitHub Desktop.
Save jperras/268801 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import redis
from optparse import OptionParser
from time import sleep
def options():
parser = OptionParser()
parser.add_option("--host", default="localhost")
parser.add_option("--port", type="int", default=6379)
return parser.parse_args()
if __name__ == '__main__':
(opts, args) = options()
r = redis.Redis(host=opts.host, port=opts.port)
um = 0
while True:
newum = r.info()['used_memory']
if newum != um and um != 0:
print('%d bytes (%d difference)') % (um, newum - um)
um = newum
sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment