import asyncore import async_memcache c = async_memcache.asyncMemCache() count = bytes = 0 class Consumer: def open(self, key): self.key = key def feed(self, data): global bytes bytes = bytes + len(data) def close(self): global count count = count + 1 consumer = Consumer() # store some stuff in the cache for ch in "123": c.set(consumer, ch, ch*1000000) import time t0 = t1 = time.time() # queries c.stats(consumer) c.version(consumer) while asyncore.socket_map: if not c.commands: if count: print "%6.2f" % (time.time() - t0), count, bytes, tt = time.time() if tt > t1: print bytes / (tt - t1), # bytes per second print # fill up the request line for i in range(10): c.get(consumer, "1", "2", "3") c.get(consumer, "2", "3", "4") c.get(consumer, "1", "1", "2") c.get(consumer, "2", "1", "1") c.get(consumer, "3", "2", "1") asyncore.poll(0.01) print "total", count, bytes