随笔分类 - 2 后端
摘要:https://www.cnblogs.com/cdaniu/p/15969988.html
阅读全文
摘要:1.网页端(浏览器)缓存: 适用用户只查询自己的信息接口,一个浏览完为一个缓存。直接在Get接口上增加 [ResponseCache(Duration = 5)],5为缓存时间,单位:S。 2.服务器缓存:适用公共接口不带参数查询。接口上增加[ResponseCache(Duration = 5)]
阅读全文
摘要:内存效率: 由于 Span<T> 可以直接引用内存中的数据,无需额外的内存分配,因此它在内存效率上非常高。 减少垃圾回收: 由于不需要创建临时对象,Span<T> 可以显著减少垃圾回收的压力,尤其对于大型数据集来说。 并行性: Span<T> 可以在多线程环境下高效地进行操作,因为它可以避免数据竞争
阅读全文
摘要:result.SetSuccess(Util.TryGetJSONObject<JObject>("{\"obj\": { \"reply\": \"" + row.response + "\" },\"code\":" + 0 + "}")); { "Success": true, "Messag
阅读全文
摘要:/// <summary> /// 支付 /// </summary> /// <returns></returns> [Route("UpdatePaymentOrder")] [HttpPost] public async Task<Robj<string>> UpdatePaymentOrde
阅读全文
摘要:[Route("DownloadOrders")] [HttpPost] public IActionResult DownloadOrders() { var input = new GetStudentByIdInput(); var list = _studentService.QuerySt
阅读全文
摘要:string jsonStr = "{\"name\":\"张三\",\"age\":\"10\"," + "\"classroom\":{\"name\":\"1年级1班\",\"desc\":\"描述\"}," + "\"students\":[{\"name\":\"小名\"},{\"name
阅读全文
摘要://把数据库中存放的相关数据,全部读入代码/内存,再由代码对其进行分页操作 var infos = _appconfigRepository.GetAll(); var IU = new Utility(); var models = IU.PagePartition<AppConfig>(info
阅读全文
摘要://Head var head = row.Head.GetType().GetProperties(); var headModel = model.Head.GetType().GetProperties(); foreach (var h in head) { if (h.Name != "C
阅读全文
摘要:/设置同时访问线程最大数量 static SemaphoreSlim _semaphore = new SemaphoreSlim(4); static void AccessDatabase(string name, int seconds) { Console.WriteLine($"{name
阅读全文
摘要://循环增加cpu、查询数据库增加内存 //优先 Find 、FindAll //其次 FirstOrDefault 、Where //加上AsNoTracking,为不跟踪实体中行记录。如果接口中存在多次同一个实体不建议加加上AsNoTracking,并且 _dbContext.SaveChang
阅读全文
摘要://SkipWhile:找与第一个连续相同值的后面数据 int[] list = { 5, 5, 6, 5, 8, 43 }; var r = list.SkipWhile(i => i == 5).ToList();// result: 6, 6, 6, 42 //TakeWhile:获取符合当前
阅读全文
摘要:/// <summary> /// 队列 /// </summary> private static BlockingCollection<UserInfo> queues = new BlockingCollection<UserInfo>(); /// <summary> /// 锁 /// <
阅读全文