Exemplo n.º 1
0
def registe_madmin():
    """注册数据库与memcached对应
    """
    MAdminManager().registe(memmode.tb_character_admin)
    MAdminManager().registe(memmode.tb_zhanyi_record_admin)
    MAdminManager().registe(memmode.tbitemadmin)
    MAdminManager().registe(memmode.tb_matrix_amin)
Exemplo n.º 2
0
def doWhenStop():
    """服务器关闭前的处理
    """
    print "##############################"
    print "##########checkAdmins#############"
    print "##############################"
    MAdminManager().checkAdmins()
Exemplo n.º 3
0
            'user': '******',
            'passwd': '111',
            'db': 'test',
            'port': 3306,
            'charset': 'utf8'
        }
    }
    dbpool.initPool(aa)

    class router:
        def db_for_read(self, **kw):
            return "master"

        def db_for_write(self, **kw):
            return "master"

    dbpool.bind_router(router)

    ma = MAdmin('tb_role_info', 'id', incrkey='id', fk="username")
    mm = ma.getObj(19)
    mm.update("username", "llllll")
    print ma.getAllPkByFk('lanjinmin')
    MAdminManager().checkAdmins()

    print "1111111111111111111"
    print ma.getAllPkByFk('lanjinmin')
    print ma.getAllPkByFk('llllll')
    import gevent

    gevent.sleep(100)
Exemplo n.º 4
0
def CheckMemDB(delta):
    """同步内存数据到数据库
    """
    MAdminManager().checkAdmins()
    reactor.callLater(delta, CheckMemDB, delta)