Running Memcached


Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering. It is available on newer platforms (v6+) without any additional compilation from source. Accounts with terminal access are eligible to use Memcached.


From the terminal, run: memcached -l -p PORT where PORT is a preassigned port to the account.

Note: use to prevent outside network activity. will only allow traffic that originates from the same server. A better solution, if connecting solely from an app locally on the server (WSGI/PHP/CGI/Rails, etc), is to specify -s /tmp/memcached.sock instead of -l/-p to specify a local UNIX domain socket instead of a TCP socket.

Configuring & Daemonizing

Now with Memcached up and running, you can create a long-term solution that starts up with the server and always runs in the background.

Note: as with most files, any line that begins with a octothorpe/pound/hash symbol (#) denotes a comment. These are never interpreted by an application, but serve as guidance. The following configuration omits these helpful comments for brevity.

Once again, from the terminal run: memcached -l -p PORT -d -P /tmp/

The only differences of note are introduction of -d and -P flags. -d daemonizes memcached to run in the background and -P saves the process identifier to a file called /tmp/ This allows you to easily kill the memcached daemon if necessary:

kill -9 $(cat /tmp/

Starting on Start-up

  1. Visit DevTask Scheduler within the control panel to schedule a new task.
  2. Under Command, enter memcached -l -p PORT -d -P /tmp/
  3. Under Scheduling, select Server Start
  4. Click Add

See also

Leave a Reply