Servers & Services > Memcached
Memcached is an in-memory key-value store for small chunks of arbitrary data. The Memcached and igbinary PHP extensions will be added to your PHP configuration when Memchached is added to your GroupStart servers.
Note: The Memcached PHP extension will not be enabled if the GroupStart option is not checked!
If the Memcached extension is active, then the following section is included in phpInfo (Webstart > Tools -> phpInfo in the MAMP PRO user interface), which shows you the configuration options.
In the upper right corner of this screen you will find information about which version of the Memcached server is used and which port is used.
Include Memcached server in GroupStart
Activate this checkbox if you want the Memcached server to start and stop automatically when the Start/Stop button in the toolbar is clicked. The Memcached PHP extension is automatically included when this option is enabled.
Maximum memory usage
Here you can set the size of the maximum available memory.
Click this button to empty the cache.
By clicking on this button a statistic is displayed.
- Allow network access to Memcached
Select this checkbox if you want to access the Memcached server over the network. Otherwise, you cannot access your Memcached server over the network, not even from other locally installed programs.
Select here how much information should be written to the log of Memcached. The following options are available:
Name Content Verbose errors, warnings Very Verbose errors, warnings, client commands, responses Extremely Verbose errors, warnings, client commands, responses, internal transitions
Path to Memcached log file
The path to your Memcached log file. This log file is located at “/Applications/MAMP PRO/logs/memcached_error.log”.
The following example shows how to connect to the Memcached server using PHP. The connection can be established either via UNIX socket or via network. In the further course of the example, a value (“MAMP PRO”) is then stored in the cache and read out again afterwards.
PHP (Connect using an UNIX socket)
<?php /* Note: The checkbox "Include Memcached server in GroupStart" must be activated under "Memcached". */ $memcached = new Memcached(); // Socket $memcached->addServer('/Applications/MAMP/tmp/memcached.sock', 0); $version = $memcached->getVersion(); echo '<pre>'; print_r($version); echo '</pre>'; $memcached->set('Key1', 'MAMP PRO'); $result = $memcached->get('Key1'); echo $result; ?>
PHP (Connect via network)
<?php /* Note: The checkbox "Include Memcached server in GroupStart" must be activated under "Memcached". */ $memcached = new Memcached(); // Network // "Allow network access to Memcached" must be activated // You can set the host to either "127.0.0.1" or "localhost". $memcached->addServer('127.0.0.1', 11211); $version = $memcached->getVersion(); echo '<pre>'; print_r($version); echo '</pre>'; $memcached->set('Key1', 'MAMP PRO'); $result = $memcached->get('Key1'); echo $result; ?>