Go: go-redis
2023-09-11 14:16:16 时间
https://github.com/go-redis/redis
package main import ( "context" "fmt" "time" "github.com/go-redis/redis/v8" ) var ( ctx context.Context rdb *redis.Client ) func init() { rdb = redis.NewClient(&redis.Options{ Network: "tcp", Addr: "192.168.8.21:6379", Username: "tenacity", Password: "tenacity", DB: 0, PoolSize: 10, }) // var cancelFunc context.CancelFunc ctx, _ = context.WithTimeout(context.Background(), 5*time.Second) // defer cancelFunc() result, err := rdb.Ping(ctx).Result() fmt.Println("result:", result) fmt.Println("err:", err) } func main() { err := rdb.Set(ctx, "name", "go", 0).Err() result, err := rdb.Ping(ctx).Result() fmt.Println(result, err) if err != nil { // panic(err) fmt.Println("err:", err) } }
相关文章
- 兼容go redis cluster的pipeline批量
- Windows 环境搭建Redis集群(win 64位)
- Go 语言体系下的微服务框架选型:Dubbo-go
- Spring中使用RedisTemplate操作Redis(spring-data-redis)
- redis储存中文,客服端读取出现乱码
- redis面试题
- python操作redis
- 【Go语言】【18】GO语言的select
- redis集群之REDIS CLUSTER
- 常用网络js链接大全(jQuery(3.4.1)、bootstrap、vue、ECharts、easyUI、React、maven、Mybatis、Spring、SpringMVC、Redis)
- 〖Python 数据库开发实战 - Redis篇⑥〗- Redis数据结构 - 字符串类型
- 【Go基础】理解go语言变量
- 【Go】go实现 — 链表
- 【Go环境】配置go环境变量、go mod命令大全
- 揭秘丨7分钟看懂华为云鲲鹏Redis背后的自研技术
- 深入理解 Redis Template及4种序列化方式__spring boot整合redis实现RedisTemplate三分钟快速入门
- 【软件测试】盘一盘工作中遇到的 Redis 异常测试
- Redis事务的简单理解
- redis_05 _ 内存快照:宕机后,Redis如何实现快速恢复
- Redis 漏斗限流 (redis-cell)
- Grafana+Prometheus系统监控之Redis
- Redis 与 set(无序集合) 相关的常用命令
- innodb为什么选择B+ Tree而不是跳表,Redis为什么选择跳表而不是B+ Tree
- 使用redis-shake工具迁移云Redis数据(二十一)
- 阿里云Redis之:配置程序接入阿里云Redis集群缓存数据(十七)
- Redis哨兵集群工作原理及架构部署(八)