PanelDOCSv1.0.0

Memcached

Turn on your own private Memcached cache, see its figures, empty it and connect your PHP apps through its socket.

The Memcached screen gives your account its own private, in-memory cache for PHP sessions and the data your apps ask for most. It works next to the Redis cache: use whichever your app supports.

Where: Control Panel › Databases › Memcached

Only your account can reach your Memcached. It listens on a socket, not a network port, and needs no password. It lives in memory: when it fills up, the oldest entries are dropped automatically.

Turn on Memcached

  1. Choose the Memory size.
  2. Click Turn on Memcached.

The sizes offered are 16 MB, 32 MB, 64 MB, 128 MB, 256 MB, 512 MB, 1 GB and 2 GB, up to your package's Memcached limit (64 MB when the account has no package). 64 MB is chosen by default when it is allowed. To change the size later, turn Memcached off and on again with the new size.

Note: if the screen says Your hosting plan does not include Memcached, ask your hosting provider to add it.

Figures

When Memcached is on, the screen shows:

Figure What it means
Status Running or Stopped, and the Memcached version
Memory used memory in use, of the size you chose
Items cached how many items are stored, and how many were dropped when the cache was full
Hit rate the share of requests answered from memory

Connect another app

The Connect another app card shows the Socket path. There is no Port (socket only — nothing else can reach it) and no Password. In PHP, add the socket as a server with port 0:

php
$m = new Memcached();
$m->addServer('/home/<account>/.memcached/memcached.sock', 0);

PHP needs the memcached extension. If it is missing, ask your hosting provider to turn it on.

Empty or turn off the cache

  • Empty the cache removes everything stored. Apps fill it again as they run.
  • Turn off Memcached asks for confirmation, then stops your Memcached, drops everything in it and frees its memory.

Note: while your account is suspended, its Memcached is stopped; it starts again when the account is unsuspended.