I’m currently using Memcached for caching purposes and Yii2 supports this well.
I however want to switch to using AWS Elasticache, which is similar to Memcached in use (as long as you select the Memcached version, not Redis).
The reason is that it allows for easier scalability, without me having to manage Memcached in the individual Amazon instances.
However, if I point from the Yii2 config file to one of the ElasticSearch nodes, the server throws the error that it needs Memcached extension installed.
The whole point is to move away from that.
Does anybody know how to properly configure Yii2 so that it uses ElasticSearch instead and doesn’t need Memcached installed locally?
Thanks for your help, yes indeed I understand now that Memcached has to be run locally as well.
I got it to work by following the Yii documentation, it was as simple as putting this in the components.php file (but can be in your Yii config file as well:
‘cache’ => [
'class' => 'yii\caching\MemCache',
'useMemcached' => true,
'servers' => [
[
'host' => '[insert your AWS ElastiCache endpoint here, see your AWS Console for this]', //the location of the AWS ElastiCache node/cluster
'port' => 11211,
'weight' => 100
]
]
],