• 授权协议:MIT
  • 开发厂商:-
  • 软件语言:Google Go
  • 更新日期:2019-05-16
go-redis-client

go-redis-client 是国内团队灵雀云开发的 Go 语言的 Redis 客户端开发包,支持 Redis 单机和集群。特性自动键前缀 创建客户端实例时使用独立的参数对象 内部使用 github.com/go-redis/redis 客户端,当前使用的是 gopkg.in/redis.v5 客户端接口示例package main

go-redis-client Redis 的 Go 客户端开发包 项目简介

go-redis-client 是国内团队灵雀云开发的 Go 语言的 Redis 客户端开发包,支持 Redis 单机和集群。特性自动键前缀 创建客户端实例时使用独立的参数对象 内部使用 github.com/go-redis/redis 客户端,当前使用的是 gopkg.in/redis.v5 客户端接口示例package main

import "redis" github.com/alauda/go-redis-client

func main() {
// check options.go for more details
opts := redis.RedisClientOptions{
Type: redis.ClientNormal,
Hosts: []string{"localhost:6379"},
Password: "123456",
Database: 0,
}
client := redis.NewRedisClient(opts)
if err := client.Ping().Err(); err != nil {
panic(err)
}

// Using cluster mode
clusterOpts := redis.RedisClientOptions{
Type: redis.ClientCluster,
Hosts: []string{"localhost:7000","localhost:7001","localhost:7002"},
Password: "123456",
Database: 0,
// all keys with a prefix
KeyPrefix: "my-app:",
}
clusterClient := redis.NewRedisClient(clusterOpts)
if err := clusterClient.Ping().Err(); err != nil {
panic(err)
}
}Supported commandsPing Incr IncrBy Decr DecrBy Expire ExpireAt Persist PExpire PExpireAt PTTL TTL Exists Get GetBit GetRange GetSet MGet Dump HExists HGet HGetAll HIncrBy HIncrByFloat HKeys HLen HMGet HMSet HSet HSetNX HVals LIndex LInsert LInsertAfter LInsertBefore LLen LPop LPush LPushX LRange lRem LSet LTrim RPop RPopLPush RPush RPushX Set Append Del Unlink SAdd SCard SDiff SDiffStore SInter SInterStore SIsMember SMembers SMove SPop SPopN SRandMember SRem SUnion SUnionStore ZAdd ZAddNX ZAddXX ZAddCh ZaddNXCh ZIncr ZIncrNX ZIncrXX ZCard ZCount ZIncrBy ZInterStore ZRange ZRangeWithScores ZRangeByScore ZRangeByLex ZRangeByScoreWithScores ZRank ZRem ZREmRangeByRank ZRemRangeByScore ZRemRangeByLex ZRevRange ZRevRangeWithScores ZRevRangeByScore ZRevRangeByLex ZRevRangeByScoreWithScores ZRevRank ZScore ZUnionStore BLPop BRPop BRPopLPush Type Scan SScan ZScan HScan Publish SubscribeTODO Update to redis.v6  Support RedisCluster Subscribe  Better support for godoc  Add docker-compose and example application  Add tests

go-redis-client Redis 的 Go 客户端开发包 相关推荐

go-redis-client Redis 的 Go 客户端开发包 评论内容