ehann / laravel-redis-store
Adds functionality to the built-in Cache's RedisStore.
0.2.1
2017-07-01 19:46 UTC
Requires
- laravel/framework: ^5.3
Requires (Dev)
- mockery/mockery: ~0.9.4
- phpunit/phpunit: ^5.4
- predis/predis: ~1.0
This package is auto-updated.
Last update: 2024-11-14 14:56:39 UTC
README
Why is this useful?
The RedisStore that comes with the Laravel Cache does not compress string values out of the box. The RedisStore in this package does. Caching string values can save a ton of memory and/or network bandwidth depending on cached item size and request frequency.
How do I use it?
Install the package...
composer require ehann/laravel-redis-store
Add a custom cache driver, like this...
public function boot() { Cache::extend('ehann-redis', function ($app) { return Cache::repository(new \Ehann\Cache\RedisStore( $app['redis'], $app['config']['cache.prefix'], $app['config']['cache.stores.redis.connection'] )); }); }
Add the ehann-redis custom driver to the redis store config in config/cache.php...
'stores' => [ 'redis' => [ 'driver' => 'ehann-redis', ], ],