targetliu / phpredis
该软件包的最新版本(1.2.1)没有提供许可信息。
Lumen 5.* 的 PhpRedis
1.2.1
2016-09-20 09:53 UTC
Requires
- laravel/lumen-framework: 5.*.*
This package is not auto-updated.
Last update: 2024-09-20 23:33:57 UTC
README
更新
1.2.1
- 不同的数据库使用不同的连接。(根据 问题 #2)
1.2.0
- 您可以选择不同的 Redis 连接。(根据 问题 #1)
1.1.0
- 将缓存驱动器移动到
Target\PHPRedis\Cache
. - 添加队列驱动器。
安装
- 安装 PhpRedis
- 运行
composer require targetliu/phpredis
- 在 .env 中配置 redis
基本
- 在 bootstrap/app.php 中添加
$app->register(TargetLiu\PHPRedis\PHPRedisServiceProvider::class);
缓存驱动器
- 为了使用 PhpRedis 与 Lumen 缓存,在 bootstrap/app.php 中添加
$app->register(TargetLiu\PHPRedis\Cache\CacheServiceProvider::class);
- 添加
'phpredis' => [
'driver' => 'phpredis',
'connection' => 'default',
],
到 stores 中,在 config/cache.php 或 vendor/laravel/lumen-framework/config/app.php 中,以使用 PhpRedis 与 Lumen 缓存
- 在 .env 中设置
CACHE_DRIVER=phpredis
队列驱动器
- 为了使用 PhpRedis 与 Lumen 队列,在 bootstrap/app.php 中添加
$app->register(TargetLiu\PHPRedis\Queue\QueueServiceProvider::class);
- 添加
'phpredis' => [
'driver' => 'phpredis',
'connection' => 'default',
'queue' => 'default',
'expire' => 60,
],
到 connections 中,在 config/queue.php 或 vendor/laravel/lumen-framework/config/queue.php 中,以使用 PhpRedis 与 Lumen 队列
- 在 .env 中设置
QUEUE_DRIVER=phpredis
用法
- 使用
app('phpredis')
,阅读 PhpRedis 文档 - 使用
app('cache')
,阅读 Lumen 文档 - 使用
app('queue')
,阅读 Lumen 文档