Setting up the Memcached Cache Driver

Problem

You want to speed up Laravel's cache.

You know by default Laravel uses the file cache driver. You want to use a speedier cache.

Solution

Use the Memcached cache driver.

Edit app/config/cache.php and change the driver to 'memcached'.

    'driver' => 'memcached',

If you have multiple memcached servers, or they're running on something other than the local machine, you'll have to edit the memcached section of app/config/cache.php also.

    'memcached' => array(
        array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100),
    ),

Discussion

Memcached is a free, high-performance, distributed memory object caching system.

To use the cache driver make sure Memcached is installed first. See the Installing Memcached recipe for details.

comments powered by Disqus