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
Navigate to the Amazon EC2 console and find the instance that is hosting your Redis cluster. Copy the Private IPs value and save it for the next step. Navigate to the ElastiCache console to begin your online migration. Choose your ElastiCache cluster, and then choose Migrate Data from Endpoint in the Actions dropdown.
Sign in to the AWS Management Console and open the ElastiCache console at https://console.aws.amazon.com/elasticache/ . From the navigation pane, choose Redis clusters. The clusters screen will appear with a list of Redis (cluster mode disabled) and Redis (cluster mode enabled) clusters.
You can use ElastiCache for caching, which accelerates application and database performance, or as a primary data store for use cases that don't require durability like session stores, gaming leaderboards, streaming, and analytics.
Amazon ElastiCache belongs to "Managed Memcache" category of the tech stack, while Redis can be primarily classified under "In-Memory Databases". "Redis" is the top reason why over 53 developers like Amazon ElastiCache, while over 842 developers mention "Performance" as the leading cause for choosing Redis.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With