Skip to content

Instantly share code, notes, and snippets.

@mikeyk mikeyk/gist:1508150
Created Dec 21, 2011

Embed
What would you like to do?
""" Run with:
gunicorn -k gevent -b 0.0.0.0:8080 test_mc:app
or
gunicorn -k sync -b 0.0.0.0:8080 test_mc:app
"""
import memcache as memcache
# toggle to try pylibmc instead
# import pylibmc as memcache
client = memcache.Client(["127.0.0.1:11222", "127.0.0.1:11223"])
def app(environ, start_response):
keys = []
for i in range(0, 50):
keys.append('key:%d' % i)
client.get_multi(keys)
status = '200 OK'
response_headers = [
('Content-type','text/plain'),
('Content-Length', str(len('OK')))
]
start_response(status, response_headers)
return iter(['OK'])
if __name__ == '__main__':
for i in range(0, 50):
client.set("key:%d" % i, "a" * 5000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.