def test_wt_set_get_delete(): set_background_task(False) client = pymemcache.client.Client(MEMCACHED_ADDR) key = MEMCACHED_NAMESPACE + 'key' client.set(key, b'value') value = client.get(key) client.delete(key) assert value == b'value'
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 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 test_bench_get(request, client, pairs, count): key, value = next(pairs) client.set(key, value) benchmark(count, client.get, key)
import pymemcache.client import datetime import time KEY = 'DATE' HOSTNAME = 'memcached' PORT = 11211 client = pymemcache.client.base.Client((HOSTNAME, PORT)) while True: print('Exporting date to memcached...') now = datetime.datetime.now() client.set(KEY, now) time.sleep(3)
def test_bench_get(request, client, pairs, count): key, value = six.next(six.iteritems(pairs)) client.set(key, value) benchmark(count, client.get, key)