directory
0.0.0-20231108073916-93b22619600a
Repository: https://github.com/kdcer/go-lib.git
Documentation: pkg.go.dev
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Package gcache provides high performance and concurrent-safe in-memory cache for process.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
敏感词查找,验证,过滤和替换
来源:
https://github.com/importcjj/sensitive
复制dict目录下的文件放在项目目录,调用InitSensitive传入文件路径初始化敏感词
*/.
Package singleflight provides a duplicate function call suppression mechanism.在一个服务中抑制对下游的多次重复请求。也就是说,如果对于某个key的请求已经存在并且正在进行,则对该key的新的请求会堵塞在这里,等原来的请求结束后,将请求得到的结果同时返回给堵塞中的请求。可用于处理缓存失效风暴(dog-pile effect)一个比较常见的使用场景是 — 我们在使用 Redis 对数据库中的一些热门数据进行了缓存并设置了超时时间,缓存超时的一瞬间可能有非常多的并行请求发现了 Redis 中已经不包含任何缓存所以大量的流量会打到数据库上影响服务的延时和质量。但是 singleflight 就能有效地解决这个问题,它的主要作用就是对于同一个 Key 最终只会进行一次函数调用,在这个上下文中就是只会进行一次数据库查询,查询的结果会写回 Redis 并同步给所有请求对应 Key 的用户:.
高效的生成随机字符串方式
from: Golang 生成随机字符串的八种方式与性能测试 https://xie.infoq.cn/article/f274571178f1bbe6ff8d974f3
*/.
No description provided by the author