Exemple #1
0
 def update_all_cache():
     print('周期刷新缓存开始')
     table_list = Data.query('show tables')
     for i in table_list:
         table_name = i[0]
         normal_task(0, Data.update_cache, (table_name,))
         # Data.update_cache(table_name)
     print('周期刷新缓存完毕')
Exemple #2
0
 def get_cache(table, safe=False):
     # print('取得缓存')
     data = Cache.get_table(table, safe)
     if data is None:
         data = {}
         print('缓存未命中')
         print(table)
         tmp = Data.select(table, [])
         for line in tmp:
             if 'id' in line:
                 data[line['id']] = line
         normal_task(0, Data.update_cache, (table,))
     return data
    def post(self, ):
        data = self.get_post_data()
        user_base = self.get_user_base(Relay.player)
        if user_base is None:
            self.send_faild(error.ERROR_FAIL)
            return
        upload_type = case_constant.uploader_type_player

        res = admin_tool.upload_case(data, user_base, upload_type)
        # 上传信息
        # 创建关键词索引
        # self.write_event_post_item(data,res)
        if res != None:
            self.send_ok({})
            normal_task(http_tools.write_event_post_item, (data, res))
            # print('download_done!')
            return
        else:
            self.send_faild(error.ERROR_FAIL)
            return
Exemple #4
0
 def delete(table, conditions, is_commit=True):
     res = Data.Base.delete(table, conditions, is_commit)
     print('触发缓存', table)
     normal_task(0, Data.update_cache, (table,))
     return res
Exemple #5
0
 def update(table, conditions, params, is_commit=True):
     data = Data.Base.update(table, conditions, params, is_commit)
     print('触发缓存', table)
     normal_task(0, Data.update_cache, (table,))
     return data
Exemple #6
0
 def insert(table, params, is_commit=True):
     res = Data.Base.insert(table, params, is_commit)
     print('触发缓存', table)
     normal_task(0, Data.update_cache, (table,))
     return res