um-flint / laravel-multi-tenant-redis by dowilcox

Laravel package to allow for a better "cache:clear".
533
0
5
Package Data
Maintainer Username: dowilcox
Maintainer Contact: dowilcox@umflint.edu (Donald Wilcox)
Package Create Date: 2017-02-02
Package Last Update: 2017-02-02
Language: PHP
License: MIT
Last Refreshed: 2024-04-24 03:03:13
Package Statistics
Total Downloads: 533
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 5
Total Forks: 0
Total Open Issues: 0

Laravel Multi Tenant Redis

By default Laravel's Redis cache store will empty the entire Redis database when running php artisan cache:clear. This can be a problem when you are running multiple applications on the same Redis instance. Laravel's "fix" for this is to change the Redis database for each application. This really isn't a solution as using different Redis databases aren't really recommended.

That is where this package comes in. It is a drop in replacement for the Redis cache store. It keeps track of the keys added to cache so that only the keys for the application will be deleted on a cache flush.

Before installing it would be a good idea to clear the application cache.

Installation

Add to your composer.json file

"um-flint/laravel-multi-tenant-redis": "0.0.*"

Register the package

In config/app.php add the service provider.

UMFlint\Cache\MultiTenantRedisServiceProvider::class,

Update config/cache.php

...
'stores' => [
        ...
        
        'multi-tenant-redis' => [
            'driver'     => 'multi-tenant-redis',
            'connection' => 'default',
        ],
    ],
...