Knowledge base

1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!

Check Memcached

Update 08/31/2026

This guide explains how to manage Memcached, and in particular, how to check if this in-memory caching system is working correctly on your managed Cloud Server.

 

Prerequisites

 

Check that Memcached is running

To verify that Memcached is working correctly:

  1. Copy the following code into a PHP file (connect to the local memcache server):

    $fp = fsockopen("localhost", 11211);
    if ($fp) {
    // on demande les stats
    fwrite($fp, "stats\n");
    while (!feof($fp)) {
    $buf = rtrim(fgets($fp));
    if (preg_match('/^STAT curr_items ([0-9]+)$/', $buf, $matches)) {
    // le nombre d'items stockes
    print $matches[1] . PHP_EOL;
    } elseif (preg_match('/(END|ERROR)/', $buf)) {
    // fin des stats
    break;
    }
    }
    fclose($fp);
    } else {
    print "Error: cannot connect to local memcached server: $!" . PHP_EOL;
    }
  2. Upload the PHP file to your hosting.
  3. Run the PHP file.

The script returns the number of items cached in the server's memory.

 

Enable Memcached on…

… Prestashop

The native integration of Memcached in the Prestashop application simplifies its configuration. To enable it:

  1. Access your Prestashop administration area.
  2. Go to the Advanced Parameters tab.
  3. Select Performance.
  4. Choose Yes from the dropdown menu under Use cache in the Caching section.
  5. Select CacheMemcached.
  6. Add a server by providing the required information, such as:
    1. the IP address: 127.0.0.1
    2. the port: 11211
    3. the weight: 1

You can check the information by clicking the "Test Server" button before saving it at the bottom of the "Caching" section.

Once this step is completed, your PrestaShop application is ready to use Memcached to cache certain API calls, database calls, and objects.


Has this FAQ been helpful?