motomedialab/laravel-redis-driver

A Laravel Redis driver override that enforces clearing of cache using prefixes, rather than a flush

v1.1.1 2024-03-23 14:13 UTC

This package is auto-updated.

Last update: 2024-04-23 14:22:27 UTC


README

A simple package that overrides the default behavior when flushing the Laravel Redis cache store.

Why?

The default behaviour of Laravel's Redis driver when calling cache()->clear() while using the Redis cache driver is to call a flushdb command for the entire Redis database. This is not always desirable, especially when using a multi tenancy Redis instance.

This package overrides that behaviour by clearing only the keys that match the cache prefix, stopping a global flushdb command from being called.

Installation

Simply pull the package in using composer, as below and you're good to go!

composer require motomedialab/laravel-redis-driver