Elasticache Drivers for Laravel Cache and Session

2.1.0 2015-06-28 20:14 UTC

This package is not auto-updated.

Last update: 2023-05-27 09:11:28 UTC


Build Status Coverage Status Packagist

AWS Elasticache Session and Cache Drivers for Laravel (Memcached specifically)


This package requires the memcached extension for PHP. Please see this link for installation instructions.

With composer, simply add "atyagi/elasticache-laravel": "~2.1" to your composer.json. (or "atyagi/elasticache-laravel": "~1.1" for Laravel 4 installations)

Once composer update is ran, add


to the providers array in app/config.php.

At this point, inside of app/session.php and app/cache.php, you can use elasticache as a valid driver.


  • 2.* represents all versions for Laravel 5
  • 1.* represents all versions for Laravel 4


All configuration lives within app/session.php and app/cache.php. The key ones are below:


  • lifetime -- the session lifetime within the Memcached environment
  • cookie -- this is the prefix for the session ID to prevent clashing


Note: for Laravel 5, make sure to add this info to the stores array as follows:

'stores' => [
  'memcached' => [
    'driver' => 'memcached',
    'servers' => [
        'host' => '<YOUR HOST>',
        'port' => '<YOUR_PORT>',
        'weight' => '<YOUR_WEIGHT>'