Example #1
0
 def test_transaction(self):
     with_transaction = hot_redis.List([1])
     without_transaction = hot_redis.List(key=with_transaction.key,
                                          client=hot_redis.HotClient())
     with hot_redis.transaction():
         with_transaction.append(1)
         self.assertEqual(len(without_transaction), 1)
     self.assertEqual(len(without_transaction), 2)
Example #2
0
    ☷
'''

import os
import sys

app_root = '/'.join(os.path.abspath(__file__).split('/')[:-2])
sys.path.append(app_root)

import click
import hot_redis
import redis

from cde import REDIS_CONF

rdb_out = hot_redis.HotClient(**REDIS_CONF)
rd = redis.StrictRedis(**REDIS_CONF)


def hot_redis_test(clear=False):
    """
        测试 hot redis 常用功能

    :return:
    """
    # clear = True
    dat = {
        'base': 10,
        'crx': 2,
        'jobbole': 1,
    }
Example #3
0
def client(*args, **kwargs):
    return hr.HotClient(*args, **kwargs)
Example #4
0
 def __init__(self):
     # url = urlparse.urlparse(os.environ.get('REDISCLOUD_URL'))
     # self.redis = redis.Redis(host=url.hostname, port=url.port, password=url.password)
     self.redis = redis.Redis(host='localhost', port=6379)
     self.connection = hot_redis.HotClient(host='localhost', port=6379)