Memcached¶
Memcached is an open source caching system.
Setting Up Memcached¶
Memcached is installed server-wide on all of our machines. To start Memcached:
- Open an SSH session.
- Enter memcached -d -m memory -s ~/memcached.sock where memory is the maximum number of megabytes of memory you want Memcached to use, and press Enter.
Once your Memcached instance is up and running, you can access it by the path of the socket file (~/memcached.sock) with the software or library which uses memcached.
Using Memcached with an Application¶
To configure Django to use Memcached, please see Configuring Django to Use Memcached.
If you want to make custom use of Memcached, there are many libraries available which make it easy to interact with a Memcached socket. Common libraries include:
- Memcache for PHP
- python-memcached for Python
- Ruby-MemCache for Ruby
Shutting Down Memcached¶
To stop your Memcached process:
- Open an SSH session.
- Find the PID of your Memcached process. Enter ps -u username -o pid,command | grep memcached and press Enter. A list of processes containing memcached will appear.
- Find the PID of your Memcached process in the list. The PID is the number in the first column.
- Enter kill PID and press Enter.
