vemcogroup / laravel-redis
Enhancements to redis driver, such as enabling a serializer and/or compression
Installs: 11 137
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- ext-redis: ^5.0|^6.0
- illuminate/redis: ^7.0|^8.0
- illuminate/support: ^7.0|^8.0
Requires (Dev)
- orchestra/testbench: ^4.0|^5.0
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2024-11-14 19:30:23 UTC
README
Description
Enhancements to redis driver, such as enabling a serializer and/or compression
Installation
You can install the package via composer:
composer require vemcogroup/laravel-redis
Remember to have redis installed with serializer and compression.
Answer yes to serializer and compression.
pecl upgrade -f redis
If you are missing igbinary
pecl install igbinary
If you are missing libzstd
brew install zstd
Usage
Start by selection the new driver vredis
in you .env
file:
REDIS_CLIENT=vredis
Compression
To use compression you have to set the type in database.php
for your redis connection:
'default' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_DB', '0'), 'options' => [ 'compression' => Redis::COMPRESSION_NONE, ], ],
You can use any of the Redis compressions available from you installation:
Redis::COMPRESSION_NONE
, Redis::COMPRESSION_ZSTD
, Redis::COMPRESSION_LZ4
Serializer
To use serialization you have to set the type in database.php
for your redis connection:
'default' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_DB', '0'), 'options' => [ 'serializer' => Redis::SERIALIZER_NONE, ], ],
You can use any of the Redis serializers available from you installation:
Redis::SERIALIZER_NONE
, Redis::SERIALIZER_PHP
, Redis::SERIALIZER_IGBINARY
, Redis::SERIALIZER_MSGPACK
, Redis::SERIALIZER_JSON