

@staticmethod
def get_or_create(room, user, nick=''):
    room = str(room)
    user = str(user)
    key = KakaoSession.generate_key(room, user)
    if ChocoCache.adapter.hexists('choco:sessions', key):
        session = ChocoCache.adapter.hget('choco:sessions', key)
        return pickle.loads(session)
    else:
        room_key = ('choco:room:%s:sessions' % room)
        session = KakaoSession(room, user, nick)
        session = pickle.dumps(session)
        multi = ChocoCache.adapter.pipeline()
        multi.hset('choco:sessions', key, session)
        multi.sadd(room_key, key)
        multi.execute()
        session = pickle.loads(session)
        return session

dataset/ETHPy150Open ssut/choco/choco/kakao/session.py KakaoSession.get_or_create/original