Download the PHP package inspirum/mcrouter without Composer
On this page you can find all versions of the php package inspirum/mcrouter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package mcrouter
Memcached with Mcrouter support for Laravel
Created as part of inspishop e-commerce platform by inspirum team.
Memcached cache store implementation for Laravel framework optimized to work with Mcrouter.
- Static cache for tags to reduces the number of queries to the Memcached server
- Support for Mcrouter prefix routing
- Optimized to be used in Kubernetes cluster with Memcached server on each node to achieve the lowest latency
System requirements
Installation
This package supports Laravel 5.3 or later (including Laravel 6/7/8).
For Laravel 5.4 and below it necessary to register the service provider in config/app.php
.
On newer versions Laravel will automatically register via Package Discovery.
Config Files
In order to edit the default configuration you may execute:
After that, config/mcrouter.php
will be created.
Or you can used environment variables:
Usage example
Cache tags are automatically prefixed with Mcrouter shared prefix.
Package support additional prefixes which can be used on Mcrouter routing prefix.
Cache tags static cache
Mcrouter configuration
This configuration example is for multiple Memcached servers, one of which is local, such as a typical Kubernetes cluster. We only want to use the local server (on the same node as pod), if possible, to achieve the lowest latency, but to invalidate the cache key on each server.
Tagged cache flush method (cache()->tags(['bop', 'zap'])->flush()
) do not use delete
operation on Memcached server but update tag cached values instead.
All operations with shared prefix (/default/shr/
) and all delete
operations are send to each nodes with AllFastestRoute
handle,
rest of the operations are send only to local server(s) with PoolRoute
handle.
Instead of
AllFastestRoute
you can useAllSyncRoute
orAllAsyncRoute
handle.
Kubernetes example
Example of Memcached with Mcrouter used on Kuberentes cluster with three nodes (10.80.10.1
, 10.80.10.2
, 10.80.10.3
).
Using DaemonSet
resource ensures that Memcached and Mcrouter will be available on each server (on ports 11211
and 11212
).
You can use status.hostIP
to inject current node IP to pod to use to connect to local Memcached/Mcrouter server.
Testing
To run unit tests, run:
To show coverage, run:
Contributing
Please see CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of mcrouter with dependencies
php Version >=7.1
illuminate/cache Version ^5.3|^6.0|^7.0|^8.0
illuminate/session Version ^5.3|^6.0|^7.0|^8.0
illuminate/support Version ^5.3|^6.0|^7.0|^8.0