We want to use Memcached but are struggling to find Craft 3 specific config examples and documentation.

The docs mention several things that seem to lead to dead-ends:

App config docs here show how to configure the component in config/app.php. But in terms of 'enabling' that component, the docs here say that cacheMethod might need to be used, presumably in config/general.php, but the link to cacheMethod goes nowhere. Also here in the changes in v3 article, is says that cacheMethod has "been removed entirely" and instead point readers to Configuration → Data Caching Config which is a missing section.

In terms of the server setup, Memcached is enabled and we have 2 nodes/hosts available.

Very confused, please help.

2 Answers 2


The docs here are what you need: https://docs.craftcms.com/v3/config/app.html#memcached-example

Which is 99% exactly what Yii uses (since they have an example of using multiple servers): https://www.yiiframework.com/doc/api/2.0/yii-caching-memcache

  • See a little more detail form my answer below, received from Craft via email. Mar 26, 2019 at 10:37

Thanks to the Craft support team who responded here and via email. Some of the docs/links I mentioned have since been corrected.

Here is the salient part of the reply I got from Brandon at Craft:

"...So to be clear, the only thing you need to do to get Craft to use Memcached is follow our Memcached Example from the Application Configuration page. That code should be placed in config/app.php, and you will need to customize the config values as needed, and create the MEMCACHED_USERNAME and MEMCACHED_PASSWORD environment variables (named whatever you want as long as you update the config file appropriately – or you can just hardcode the values but we wouldn’t recommend that)."

I can confirm that this works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.