douxun2023 2017-10-03 16:38
浏览 191

如何通过Golang使用AWS的Elasticache Redis的put和获取数据

I tried to connect to elasticache to put data but I have not found a method to perform put the data. How can I put and get data on elasticache resdis of aws? my code

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
  • 写回答

1条回答 默认 最新

  • dongyoulou4829 2017-10-03 16:54
    关注

    This Go SDK that you are using provides APIs for managing your ElastiCache infrastructure, such as create/delete clusters or snapshots, add tags, purchase cache nodes etc. It doesn't provide APIs to put or get items inside the cache.

    The Redis cluster that ElastiCache gives you is similar to the one that you might have installed on your own. So, you can connect it with the usual Go libraries outside AWS SDK. For e.g., go-redis/redis or garyburd/redigo.

    In short, use the AWS SDK to manage your ElastiCache infrastructure and Redis' Go clients to put or get items from the cache.

    评论

报告相同问题?

悬赏问题

  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏