LaravelPackages.net
Acme Inc.
Toggle sidebar
vemcogroup/laravel-redis

Enhancements to redis driver, such as enabling a serializer and/or compression

11.947
2
0.1.1
About vemcogroup/laravel-redis

vemcogroup/laravel-redis is a Laravel package for enhancements to redis driver, such as enabling a serializer and/or compression. It currently has 2 GitHub stars and 11.947 downloads on Packagist (latest version 0.1.1). Install it with composer require vemcogroup/laravel-redis. Discover more Laravel packages by vemcogroup or browse all Laravel packages to compare alternatives.

Last updated

Laravel Redis

Latest Version on Packagist Total Downloads tests

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

Star History Chart