Пример #1
0
def send_job(job_name, value):
    jobs = config.redis_jobs()
    job = jobs.get(job_name)
    if not job:
        return None
    rdb = RedisManager.get_instance()
    return rdb.lpush(job, value)
Пример #2
0
def add_service(service_name, value, score):
    if not score:
        score = 0
    service = config.redis_services().get(service_name)
    if not service:
        return None
    return RedisManager.get_instance().zadd(service, score, value)
Пример #3
0
def receive_job(job_name):
    jobs = config.redis_jobs()
    job = jobs.get(job_name)
    if not job:
        return None
    rdb = RedisManager.get_instance()
    return rdb.rpop(job)
Пример #4
0
def send_job(job_name, value):
    jobs = config.redis_jobs()
    job = jobs.get(job_name)
    if not job:
        return None
    rdb = RedisManager.get_instance()
    return rdb.lpush(job, value)
Пример #5
0
def add_service(service_name, value, score):
    if not score:
        score = 0
    service = config.redis_services().get(service_name)
    if not service:
        return None
    return RedisManager.get_instance().zadd(service, score, value)
Пример #6
0
def receive_job(job_name):
    jobs = config.redis_jobs()
    job = jobs.get(job_name)
    if not job:
        return None
    rdb = RedisManager.get_instance()
    return rdb.rpop(job)
Пример #7
0
def get_service(service_name, score_max, score_min=0, withscores=False):
    service = config.redis_services().get(service_name)
    if not service:
        return None
    return RedisManager.get_instance().zrangebyscore(name=service,
                                                     min=score_min,
                                                     max=score_max,
                                                     withscores=withscores)
Пример #8
0
def get_service(service_name, score_max, score_min=0, withscores=False):
    service = config.redis_services().get(service_name)
    if not service:
        return None
    return RedisManager.get_instance().zrangebyscore(name=service, min=score_min, max=score_max, withscores=withscores)