Each web origin has the memcached installed. To run an instance for your web site, create a "forever" cron job with the following command:
/usr/bin/memcached -m 64 -s /home/sites/SITE/include/memcached.sock
Replace "SITE" with your actual site number.
In your software, connect to the memcached by specifying the path to the socket (/home/sites/SITE/include/memcached.sock
in the example above).
For example, here is a PHP script:
<?php
$sockPath = '/home/sites/SITE/include/memcached.sock';
$port = 0;
$memcached = new Memcached();
$memcached->addServer($sockPath, $port);
$key = 'mykey';
$value = 'Hello, Memcached!';
$expiration = 900;
$memcached->set($key, $value, $expiration);
?>
If using with a WordPress site, you can install the Object Cache 4 Everyone plugin and add the following to your wp-config.php
file:
define(‘OC4EVERYONE_MEMCACHED_SERVER’, ‘/home/sites/SITE/include/memcached.sock:0’);