Looking to hire Laravel developers? Try LaraJobs

laravel-multi-memcached maintained by fsavina

Description
Extract multiple memcached server configuration from .env file
Author
Last update
2018/03/05 11:21 (dev-master)
License
Downloads
12 880

Comments
comments powered by Disqus

laravel-multi-memcached

Latest Stable Version Total Downloads License

Use multiple Memcached servers in your Laravel project directly from your .env file.

Installation

Install the package in your project

$ composer require fsavina/laravel-multi-memcached

Usage

In your config/cache.php file, change to Memcached server configuration calling the provided helper function laravel_memcached_servers:

'memcached' => [
  'driver' => 'memcached',
  'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
  [...]
  'servers' => laravel_memcached_servers ()
]

Configuration

In your .env file add the following variables:


#comma-separated list of Memcached servers
MEMCACHED_HOST=my.first.memcached.server.com@100,my.second.memcached.server.com:11222@90

#optional - default Memcached port
MEMCACHED_PORT=11211

For every provided server you can specify:

  • the port: use the standard format :11211, following the host name;
  • the weight: use the format @90 following the host name and the port (if present).

Both port and weight are optional. You can use MEMCACHED_PORT for the default port, which will be used for all the servers. The default weight, if not specified, is 100.