示例#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
文件: mimo.py 项目: liwxzju/proxypool
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
文件: mimo.py 项目: liwxzju/proxypool
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
文件: mimo.py 项目: liwxzju/proxypool
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
文件: mimo.py 项目: liwxzju/proxypool
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)