上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 49 下一页
摘要: aof-use-rdb-preamble 选项设置为 yes,并且要同时启用 RDB 和 AOF 两种持久化 启用 AOF 模式 将 appendonly 设置为 yes。默认是 no。 always: 每次写操作后都同步。 everysec: 每秒同步一次。 no: 由操作系统决定何时同步。 默认 阅读全文
posted @ 2024-09-12 14:54 朝阳1 阅读(43) 评论(0) 推荐(0)
摘要: 先搭建nats集群 -js 代表开启stream,这个时候必须起名字。如果节点不加入集群,那就不用配置--routes,以及-js version: "3.5" services: nats: image: nats ports: - "8222:8222" - "4222:4222" - "622 阅读全文
posted @ 2024-09-12 10:25 朝阳1 阅读(346) 评论(0) 推荐(0)
摘要: hello.proto syntax="proto3"; package pb; option go_package = "./pb"; service Greeter { rpc SayHello(HelloRequest) returns(HelloReply){} } message Hell 阅读全文
posted @ 2024-09-11 14:45 朝阳1 阅读(22) 评论(0) 推荐(0)
摘要: 结构体 type Context interface { // 标识deadline是否已经设置了,没有设置时,ok的值是false,并返回初始的time.Time Deadline() (deadline time.Time, ok bool) // 返回一个channel, 当返回关闭的chan 阅读全文
posted @ 2024-09-11 09:50 朝阳1 阅读(48) 评论(0) 推荐(0)
摘要: 固定窗口 package main import ( "fmt" "sync" "sync/atomic" "time" ) // 定义限流结构体 type RateLimiter struct { interval time.Duration // 时间窗口 tokens int32 // 令牌总 阅读全文
posted @ 2024-09-06 09:42 朝阳1 阅读(79) 评论(0) 推荐(0)
摘要: padding的填充方式可以根据自己需要修改 php $key = 'a7gE3fH9jKmN1pQ2rS4tU6vY8zW9xL0'; $iv = '7hJ3kQxZW45mNpR'; $data = '123456'; $encrypted = openssl_encrypt($data, 'A 阅读全文
posted @ 2024-09-05 15:32 朝阳1 阅读(105) 评论(0) 推荐(0)
摘要: package main import ( "encoding/json" "fmt" "github.com/gin-gonic/gin" "github.com/natefinch/lumberjack" "go.uber.org/zap" "go.uber.org/zap/zapcore" " 阅读全文
posted @ 2024-09-05 14:42 朝阳1 阅读(152) 评论(0) 推荐(0)
摘要: 没用singleflight之前 package main import ( "fmt" "sync" "time" ) var ( mx sync.Mutex wg sync.WaitGroup cacheData = make(map[string]string, 0) ) func main( 阅读全文
posted @ 2024-09-03 15:09 朝阳1 阅读(32) 评论(0) 推荐(0)
摘要: package main import "fmt" const RED = 0 const BLACK = 1 type Type int type RBNode struct { color uint8 key Type left, right, parent *RBNode } type RBR 阅读全文
posted @ 2024-09-02 10:18 朝阳1 阅读(17) 评论(0) 推荐(0)
摘要: package main import ( "fmt" ) type AVLNode struct{ data int height int left, right *AVLNode } func max(a, b int) int { if a > b { return a } return b 阅读全文
posted @ 2024-09-02 10:17 朝阳1 阅读(11) 评论(0) 推荐(0)
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 49 下一页