<p>The docs here are what you need: <a href="https://docs.craftcms.com/v3/config/app.html#memcached-example" rel="nofollow noreferrer">https://docs.craftcms.com/v3/config/app.html#memcached-example</a></p>

<p>Which is 99% exactly what Yii uses (since they have an example of using multiple servers): <a href="https://www.yiiframework.com/doc/api/2.0/yii-caching-memcache" rel="nofollow noreferrer">https://www.yiiframework.com/doc/api/2.0/yii-caching-memcache</a></p>

CC BY-SA 4.0
2019-03-26T10:37:35.727Z
See a little more detail form my answer below, received from Craft via email.
Mere Development
CC BY-SA 4.0
2019-03-25T04:31:24.613Z
2019-03-25T04:31:24.613Z
Brad Bell
<p>Thanks to the Craft support team who responded here and via email. Some of the docs/links I mentioned have since been corrected. </p>

<p>Here is the salient part of the reply I got from Brandon at Craft:</p>

<blockquote>
  <p>"<em>...So to be clear, the only thing you need to do to get Craft to use
  Memcached is follow our <a href="https://docs.craftcms.com/v3/config/app.html#memcached-example" rel="nofollow noreferrer">Memcached
  Example</a>
  from the Application Configuration page. That code should be placed in
  <code>config/app.php</code>, and you will need to customize the config values as
  needed, and create the <code>MEMCACHED_USERNAME</code> and <code>MEMCACHED_PASSWORD</code>
  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).</em>"</p>
</blockquote>

<p>I can confirm that this works. </p>

CC BY-SA 4.0
2019-03-26T10:36:40.440Z
2019-03-26T10:36:40.440Z
Mere Development
<p>We want to use Memcached but are struggling to find Craft 3 specific config examples and documentation. </p>

<p>The docs mention several things that seem to lead to dead-ends: </p>

<p><a href="https://docs.craftcms.com/v3/config/app.html#cache-component" rel="nofollow noreferrer">App config docs here</a> show how to configure the component in config/app.php. But in terms of 'enabling' that component, the <a href="https://docs.craftcms.com/v3/changes-in-craft-3.html#memcache" rel="nofollow noreferrer">docs here</a> say that <code>cacheMethod</code> might need to be used, presumably in config/general.php, but the <a href="https://docs.craftcms.com/v3/config/config-settings.html#cachemethod" rel="nofollow noreferrer">link to cacheMethod</a> goes nowhere. Also here in the <a href="https://docs.craftcms.com/v3/changes-in-craft-3.html#config-settings" rel="nofollow noreferrer">changes in v3 article</a>, is says that <code>cacheMethod</code> has "been removed entirely" and instead point readers to <a href="https://docs.craftcms.com/v3/config/#data-caching-config" rel="nofollow noreferrer">Configuration → Data Caching Config</a> which is a missing section. </p>

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

<p>Very confused, please help.</p>

<cache>
Help setting up Memcached in Craft 3
# Help setting up Memcached in Craft 3

(Asked by: username_0 on 2019-03-22)

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](https://docs.craftcms.com/v3/config/app.html#cache-component) show how to configure the component in config/app.php. But in terms of 'enabling' that component, the [docs here](https://docs.craftcms.com/v3/changes-in-craft-3.html#memcache) say that `cacheMethod` might need to be used, presumably in config/general.php, but the [link to cacheMethod](https://docs.craftcms.com/v3/config/config-settings.html#cachemethod) goes nowhere. Also here in the [changes in v3 article](https://docs.craftcms.com/v3/changes-in-craft-3.html#config-settings), is says that `cacheMethod` has "been removed entirely" and instead point readers to [Configuration → Data Caching Config](https://docs.craftcms.com/v3/config/#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.

**Tags:** cache

---

## 2 answers

### Answer by username_1 on 2019-03-25. Score: 1 | Accepted answer

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>

> **Comments:**
> **username_0**: See a little more detail form my answer below, received from Craft via email.  

---

### Answer by username_0 on 2019-03-26. Score: 1

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](https://docs.craftcms.com/v3/config/app.html#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.


---

