示例#1
0
def make_ss(session):
    sid = session.sid
    if not sid:
        in_mc = in_db = False
    else:
        pdump = memcache.get(sid)
        if pdump and session.data == Session._Session__decode_data(pdump):
            in_mc = True
        else:
            in_mc = False

        try:
            sm = SessionModel.get_by_key_name(sid)
            if sm and session.data == Session._Session__decode_data(sm.pdump):
                in_db = True
            else:
                in_db = False
                if sm:
                    logger.info('in db, but stale: current=%s db=%s' %
                                (session.data,
                                 Session._Session__decode_data(sm.pdump)))
                else:
                    logger.info('session not in db at all')
        except Exception, e:
            logging.warn('db failed: %s => %s' % (type(e), e))
            in_db = False  # db failure (perhaps it is down)
示例#2
0
def make_ss(session):
    sid = session.sid
    if not sid:
        in_mc = in_db = False
    else:
        pdump = memcache.get(sid)
        if pdump and session.data==Session._Session__decode_data(pdump):
            in_mc = True
        else:
            in_mc = False

        try:
            sm = SessionModel.get_by_key_name(sid)
            if sm and session.data==Session._Session__decode_data(sm.pdump):
                in_db = True
            else:
                in_db = False
                if sm:
                    logger.info('in db, but stale: current=%s db=%s' % (session.data, Session._Session__decode_data(sm.pdump)))
                else:
                    logger.info('session not in db at all')
        except Exception, e:
            logging.warn('db failed: %s => %s' % (type(e), e))
            in_db = False  # db failure (perhaps it is down)
示例#3
0
 def get(self):
     memcache.flush_all()
     db.delete(SessionModel.all(keys_only=True).fetch(1000))
示例#4
0
 def get(self):
     num_before = SessionModel.all().count()
     delete_expired_sessions()
     num_after = SessionModel.all().count()
     self.response.out.write('%d,%d' % (num_before, num_after))
示例#5
0
 def get(self):
     memcache.flush_all()
     db.delete(SessionModel.all(keys_only=True).fetch(1000))
示例#6
0
 def get(self):
     num_before = SessionModel.all().count()
     delete_expired_sessions()
     num_after = SessionModel.all().count()
     self.response.out.write('%d,%d' % (num_before, num_after))