---
title: "Running Memcached"
date: "2015-03-15"
category: "guides"
slug: "running-memcached"
---

Memcached is an in-memory key-value store for caching database results, API responses, rendered pages, and other frequently accessed data. It is available on [[determining-platform-version]] (v6+) without [[compiling-programs]] from source. Accounts with [[is-terminal-access-available]] are eligible to use Memcached.

## Quickstart

From the [[accessing-terminal]], run:

```
memcached -l 127.0.0.1 -p PORT
```

Replace `PORT` with a [[listening-ports]] assigned to your account.

> **Note:** Binding to `127.0.0.1` restricts access to local traffic only. For applications running on the same server ([[using-wsgi]], PHP, CGI, [[setting-rails-passenger]], etc.), you can use a UNIX socket instead for better performance: `-s /tmp/memcached.sock` (omit the `-l` and `-p` flags).

## Configuring and Daemonizing

To run Memcached as a background service that persists across sessions:

```
memcached -l 127.0.0.1 -p PORT -d -P /tmp/memcached.pid
```

The `-d` flag daemonizes the process, and `-P` saves the process ID to a file. To stop Memcached later:

```
kill -9 $(cat /tmp/memcached.pid)
```

### Starting on Server Boot

1. In the [[logging-into-the-control-panel]], navigate to **Dev** > **Task Scheduler**
2. Under **Command**, enter: `memcached -l 127.0.0.1 -p PORT -d -P /tmp/memcached.pid`
3. Under **Scheduling**, select **Server Start**
4. Click **Add**

## See Also

- Memcached [documentation](https://code.google.com/p/memcached/wiki/NewStart)
