summaryrefslogtreecommitdiff
path: root/memcache.py
diff options
context:
space:
mode:
authorSean Reifschneider <jafo@tummy.com>2010-12-15 20:02:51 -0700
committerSean Reifschneider <jafo@tummy.com>2010-12-15 20:02:51 -0700
commit001dadd0e75dead077086a4d4e1d08cd55c0190f (patch)
treebbdac215b21f0339146fa97f0f0933f8ecd43fbe /memcache.py
parent96d52dc08d7dafc32a485a984eb042c24d71a906 (diff)
downloadpython-memcached-001dadd0e75dead077086a4d4e1d08cd55c0190f.tar.gz
Bug #633553: Add stat arguments support.
Diffstat (limited to 'memcache.py')
-rw-r--r--memcache.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/memcache.py b/memcache.py
index 2f066fc..f7bc013 100644
--- a/memcache.py
+++ b/memcache.py
@@ -198,9 +198,12 @@ class Client(local):
self.servers = [_Host(s, self.debug) for s in servers]
self._init_buckets()
- def get_stats(self):
+ def get_stats(self, stat_args = None):
'''Get statistics from each of the servers.
+ @param stat_args: Additional arguments to pass to the memcache
+ "stats" command.
+
@return: A list of tuples ( server_identifier, stats_dictionary ).
The dictionary contains a number of name/value pairs specifying
the name of the status field and the string value associated with
@@ -213,7 +216,10 @@ class Client(local):
name = '%s:%s (%s)' % ( s.ip, s.port, s.weight )
else:
name = 'unix:%s (%s)' % ( s.address, s.weight )
- s.send_cmd('stats')
+ if not stat_args:
+ s.send_cmd('stats')
+ else:
+ s.send_cmd('stats ' + stat_args)
serverData = {}
data.append(( name, serverData ))
readline = s.readline