def run_client_test(name, client, size, count): client.flush_all() value = 'X' * size start = time.time() for i in range(count): client.set(str(i), value) for i in range(count): client.get(str(i)) duration = time.time() - start print("{0}: {1}".format(name, duration))
def client(request, host, port): if request.param == "pylibmc": if not HAS_PYLIBMC: pytest.skip("requires pylibmc") client = pylibmc.Client([f'{host}:{port}']) client.behaviors = {"tcp_nodelay": True} elif request.param == "memcache": if not HAS_MEMCACHE: pytest.skip("requires python-memcached") client = memcache.Client([f'{host}:{port}']) elif request.param == "pymemcache": if not HAS_PYMEMCACHE: pytest.skip("requires pymemcache") client = pymemcache.client.Client((host, port)) else: pytest.skip(f"unknown library {request.param}") client.flush_all() return client
def client(request, host, port): if request.param == "pylibmc": if not HAS_PYLIBMC: pytest.skip("requires pylibmc") client = pylibmc.Client(['{0}:{1}'.format(host, port)]) client.behaviors = {"tcp_nodelay": True} elif request.param == "memcache": if not HAS_MEMCACHE: pytest.skip("requires python-memcached") client = memcache.Client(['{0}:{1}'.format(host, port)]) elif request.param == "pymemcache": if not HAS_PYMEMCACHE: pytest.skip("requires pymemcache") client = pymemcache.client.Client((host, port)) else: pytest.skip("unknown library {0}".format(request.param)) client.flush_all() return client