08 2024 档案
发表于 2024-08-20 23:04阅读次数:93评论次数:0
摘要:public async Task<string> Wait3S() { await Task.Delay(3000); Console.WriteLine("Wait 3 S"); return ""; } #region 异步任务-状态机 #if true TestClass testClass
阅读全文 »
发表于 2024-08-19 00:39阅读次数:27评论次数:0
摘要:服务端测试代码 静态类 public class StaticClass { public static int Count = 0; public static int SafeCount = 0; public static int GetCount() { return Count++; }
阅读全文 »
发表于 2024-08-09 00:04阅读次数:28评论次数:0
摘要:冒泡排序 // 冒泡排序加去重 public static int[] DistinctAndOrder(int[] OldArray) { if (OldArray != null && OldArray.Length > 0) { //排序 for (int i = 0; i < OldArra
阅读全文 »
发表于 2024-08-08 23:50阅读次数:30评论次数:0
摘要:一、单一职责、命名规范遵循restful 二、接口安全 参数校验 接口鉴权 敏感数据脱敏、加密 防重复提交(前端控制、时间戳、接口幂等性) 数据防篡改(签名)
阅读全文 »
发表于 2024-08-05 16:12阅读次数:65评论次数:0
摘要:一、Nuget引入 StackExchange.Redis、DistributedLock.Redis依赖 二、使用 StackExchange.Redis 对redis操作做简单封装 public class RedisHelper { private static ConnectionMulti
阅读全文 »
发表于 2024-08-01 03:33阅读次数:44评论次数:0
摘要:晚上睡不着,脑子里总想着一些问题,试着写一写对于SQL查询优化的见解。 首先,数据库有自己的查询优化器,执行一条查询SQL优化器会选择最优的方式(不走索引、走索引、走哪个索引), 所以索引不是越多越好,因为创建索引需要成本,提高索引命中率是优化SQL的关键。 索引分为主键索引和普通索引,在Mysql
阅读全文 »