def update_issue_filter_cache(key, filter_id): RedisService.delete_value(key) if str(filter_id) != "0": filter = IssueFilter.objects.get(int(filter_id)) if filter.FilterCacheString: for filter_item in eval(filter.FilterCacheString): RedisService.set_svalue(key, filter_item, 7 * 24 * 3600)
def remove_cache(request): message = "True" try: cache_key = request.POST.get("cache_key") RedisService.delete_value(cache_key) except Exception as ex: SimpleLogger.exception(ex) message = str(ex) return HttpResponse(message)
def clean_issue_filter(request): message = True try: word_key = str(request.user.id) + "_issue_searchkeyword" filter_key = str(request.user.id) + "_issue_filter" RedisService.delete_value(word_key) RedisService.delete_value(filter_key) except Exception as ex: SimpleLogger.exception(ex) message = str(ex) return HttpResponse(message)
def store_cached_file(cached_file_keys): result = "" keys = cached_file_keys.split(',') for key in keys: if key != "": temp_file = RedisService.get_object(key) if temp_file != None: RedisService.delete_value(key) mongo_id = MongoDBService.save_file( temp_file, IssueMongoFile) file_id = FileInfoService.add_file(0, mongo_id, temp_file.name, 1, 0, temp_file.size) if file_id != 0: result = result + str(file_id) + "," return result
def save_build_log(tq_id,tq_done=False): file_name="ci_build_log"+tq_id+".log" build_log=RedisService.get_value("ci_build_log"+tq_id) result=MongoDBService.save_content_asfile(file_name, build_log,BuildLogMongoFile) file_id=FileInfoService.add_file(0,result,file_name,1,0,len(build_log)) RedisService.delete_value("ci_build_log" + tq_id) if tq_done: temp_output = CITaskStepOutput() temp_output.ProductType = 1 temp_output.ProductID = file_id task_queue = TaskQueue.objects.get(int(tq_id)) task_history = CITaskHistory.objects.get_history_by_uuid(task_queue.TaskUUID) temp_output.TaskHistoryID = task_history.id temp_output.TaskID = task_history.CITaskID temp_output.StepID = "" temp_output.StageHistoryID = 0 temp_output.save() else: RedisService.set_value("ci_build_log"+tq_id,"") return file_id
def cache_issue_search_word(key, value): if RedisService.has_key(key): RedisService.delete_value(key) RedisService.set_value(key, value, 1800) else: RedisService.set_value(key, value, 1800)