def _test_thinhash(conn): conn.delete('test') h = ThinHash('test', 10000, connection=conn) l = range(10) l.extend(range(10)) h.hmset(*l) assert list(h.hmget(*range(10))) == ['1', None, '3', None, '5', None, '7', None, '9', None]
def _test_thinhash(conn): conn.delete('test') h = ThinHash('test', 10000, connection=conn) l = range(10) l.extend(range(10)) h.hmset(*l) assert list(h.hmget(*range(10))) == [ '1', None, '3', None, '5', None, '7', None, '9', None ]
def check_thinhashsize(count=10000): thinhashkey = 'testthinhash' conn.flushall() h = ThinHash(thinhashkey, count, connection=conn) args = [] for _ in xrange(count): args.append(randid()) args.append(randts()) h.hmset(*args) print('it takes {} for {} thinhashs'.format(conn.info()['used_memory_human'], h.count()))
def check_thinhashsize(count=10000): thinhashkey = 'testthinhash' conn.flushall() h = ThinHash(thinhashkey, count, connection=conn) args = [] for _ in xrange(count): args.append(randid()) args.append(randts()) h.hmset(*args) print('it takes {} for {} thinhashs'.format( conn.info()['used_memory_human'], h.count()))
def gethash(type): hashkey = LC.hashkey.format(type) if type == 'item': count = 2 * 10000 * 10000 elif type == 'shop': count = 500 * 10000 elif type == 'shopinfo': count = 500 * 10000 else: raise ValueError('wrong LC type: {}'.format(type)) return ThinHash(hashkey, count, connection=conn)