Hườ*_*Thị 2 go amazon-web-services amazon-elasticache
我试图连接到elasticache来放置数据,但我还没有找到执行放置数据的方法.如何在aws的elasticache resdis上输入和获取数据?我的代码
mySession := getAWSSession()
svc := elasticache.New(mySession)
input := &elasticache.CreateCacheClusterInput{
AutoMinorVersionUpgrade: aws.Bool(true),
CacheClusterId: aws.String("my-redis"),
CacheNodeType: aws.String("cache.r3.larage"),
CacheSubnetGroupName: aws.String("default"),
Engine: aws.String("redis"),
EngineVersion: aws.String("3.2.4"),
NumCacheNodes: aws.Int64(1),
Port: aws.Int64(6379),
PreferredAvailabilityZone: aws.String("us-east-1c"),
SnapshotRetentionLimit: aws.Int64(7),
}
result, err := svc.CreateCacheCluster(input)
var data = Logo{}
data.name = "test1"
data.logo = "test2"
// how to put and get data from elasticache
Run Code Online (Sandbox Code Playgroud)
这是您正在使用转到SDK提供API来管理您的ElastiCache基础设施,如创建/删除集群或快照,添加标签,购买缓存节点等,它不提供的API把或获得项目内的缓存.
ElastiCache为您提供的Redis群集类似于您自己安装的群集.因此,您可以将其与AWS SDK外部的常用Go库连接.例如,go-redis/redis或garyburd/redigo.
简而言之,使用AWS SDK管理您的ElastiCache基础架构和Redis的Go客户端以从缓存中放入或获取项目.