Пример #1
0
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]
Пример #2
0
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
    ]
Пример #3
0
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()))
Пример #4
0
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()))