To enable Memcached on your website hosted by Cloud Platform, you must install the Memcache API and Integration module in your codebase, and configure the module for use.
When configuring your website to use Memcached, be aware of the following considerations:
memcache_key_prefix
or memcache_servers
settings, as
Cloud Platform adds the correct values in Acquia-specific code defined by the
Acquia require line, or
otherwise available by default on Acquia Cloud Next. Altering these values
can cause unexpected behavior.memcache_admin
submodule, you must enable the Memcache API and Integration module. Although Drupal 9
doesn’t require you to enable the module, Acquia recommends
enabling the module to receive notifications about module updates.Important
Be sure to test any of the procedures provided by this documentation page on a non-production environment before implementing them on your production environment.
For Memcached to function, you must provide additional configuration code that enables autoloading, and identifies Memcached as an alternative cache back-end.
To configure your website for Memcached, make the following changes to your codebase, depending on your subscription type:
Note
For environments running on Acquia Cloud Next
technologies, steps 2 and 3 aren’t required because Memcache
configuration logic is included automatically. To exclude this logic
on your environments, add the following line to your settings.php
file:
define('AH_NO_MEMCACHE_INCLUDE', 1);
Download the Memcache API and Integration module, and then add
the module to your codebase in the modules/contrib/memcache
directory.
Download cloud-memcache-d8+.php
, and
then add it to your codebase in the sites/default
directory.
For each website that requires Memcached, edit the Cloud Platform
database require line in
settings.php
with a PHP include()
or require()
statement,
similar to the following example:
if (file_exists('/var/www/site-php')) {
require('/var/www/site-php/mysite/mysite-settings.inc');
// Memcached settings for Acquia Hosting
if (file_exists(DRUPAL_ROOT . '/sites/default/cloud-memcache-d8+.php')) {
require(DRUPAL_ROOT . '/sites/default/cloud-memcache-d8+.php');
}
}
Rebuild caches by running the following command, replacing
[example.com]
with the domain name of your website:
drush cr --uri=[example.com]
Truncate all cache_
tables in the database for the website.
Memcache is now enabled for your website. If you need assistance, contact Acquia support.
Download the Memcache API and Integration module and add
the module to your codebase in the modules/contrib/memcache
directory.
Download acsfd8+.memcache.settings.php
,
and then add it to the factory-hooks/post-settings-php
directory. For more information about the post-settings-php hook,
see Altering values in settings.php with hooks.
Rebuild caches by running the following command, replacing
[example.com]
with the domain name of your website:
drush cr --uri=[example.com]
Truncate all cache_
tables in the database for the website.
Memcache is now enabled for your website. If you need assistance, contact Acquia support.
For Acquia BLT users
BLT users that continue to experience issues should submit a ticket to the Acquia BLT issue queue.
If you are installing the module on a Drupal 7 website, you must enable the
module before modifying settings.php
, or you will receive a
ServiceNotFoundException:
error message.
Note
For Drupal 7 environments running on Acquia Cloud Next
technologies, step 2 isn’t required because Memcache configuration logic is
included automatically. To exclude this logic on your environments, add the
following line to your settings.php
file:
define('AH_NO_MEMCACHE_INCLUDE', 1);
To configure your Drupal 7 website for Memcached, make the following changes to your codebase, depending on your subscription type:
Download the Memcache API and Integration module, and then add
the module to your codebase in the
sites/all/modules/contrib/memcache
directory.
Download cloud-memcache-d7.php
, and
then add the contents of the file to your website’s settings.php
file, after the Acquia database require line.
Clear caches by running the following command, replacing
[example.com]
with the domain name of your website:
drush cc all --uri=[example.com]
Truncate all cache_
tables in the database for the website.
Memcache is now enabled for your website. If you need assistance, contact Acquia support.
Download the Memcache API and Integration module, and then add
the module to your codebase in the
sites/all/modules/contrib/memcache
directory.
Download acsfd7.memcache.settings.php
,
and then add it to the factory-hooks/post-settings-php
directory. For more information about the post-settings-php hook,
see Altering values in settings.php with hooks.
Edit the file, modifying the following lines if they do not correspond to the location of the Memcache API and Integration module in your codebase:
$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';
$conf['lock_inc'] = 'sites/all/modules/contrib/memcache/memcache-lock.inc';
Clear caches by running the following command , replacing
[example.com]
with the domain name of your website:
drush cc all --uri=[example.com]
Truncate all cache_
tables in the database for the website.
Memcache is now enabled for your website. If you need assistance, contact Acquia support.
For environments running on Acquia Cloud Next technologies, you can adjust the memory allocated to Memcached by navigating to the Environment Settings page of the Acquia Cloud Platform user interface and selecting the Advanced tab.
For environments running on the Acquia Cloud Classic infrastructure, you must contact Acquia Support to request that your Memcached memory allocation be modified. Larger amounts of memory can be allocated to Cloud Classic environments with dedicated Memcached infrastructure. Contact your Acquia account team for more information about this advanced configuration.
To allocate memory to Memcached on Cloud Platform Professional and enable it to run, use the following procedure:
Sign in to the Acquia Cloud Platform user interface and select your application, and then select the environment.
In the left menu, click Servers.
In the card for the web infrastructure, click the Configure link.
In the Memcached memory (MB) field, enter the amount of memory to allocate to Memcached. A value of 64 MB is the default value for applications running on Cloud Platform, but you may increase the value depending on the needs of your application.
Click Save.