fsavina / laravel-multi-memcached
Extract multiple memcached server configuration from .env file
Installs: 10 840
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.0
Requires (Dev)
- phpunit/phpunit: ~5.4
This package is auto-updated.
Last update: 2024-10-28 22:06:11 UTC
README
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.