Esempio n. 1
0
def register_member(member_id, access_token):
    r = redis_member(member_id)
    if not r:
        logger.error('Can not access member redis')
        return False

    pipe = r.pipeline()
    pipe.set(member_id, to_utf8(access_token))
    pipe.expire(member_id, app.EXPIRE_TIME)
    pipe.execute()
    return True
Esempio n. 2
0
def verify_member(member_id, access_token):
    r = redis_member(member_id)
    if not r:
        logger.error('Can not access member redis')
        return False

    # matching access_token by member_id
    if access_token != r.get(member_id):
        logger.error('Mismatch access_token and member;{member_id:%d}' % (member_id))
        return False

    # update expire time
    r.expire(member_id, app.EXPIRE_TIME)
    return True