Reputation: 71
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
Upvotes: 6
Views: 9065
Reputation: 5659
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.
Upvotes: 19