blink/redis 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

blink/redis

最新稳定版本:v0.3.0

Composer 安装命令:

composer require blink/redis

包简介

A redis component for the Blink framework

README 文档

README

Build Status Latest Stable Version Latest Unstable Version

Features

  • A Redis Client compatible with Predis API
  • Implemented PSR-16 SampleCache
  • A Session Storage class to store sessions into redis

Installation

You can install the latest version of blink-redis by using Composer:

composer require blink/redis:dev-master

Documentation

Configuring a redis service

You can easily configure a redis service in the services definition file which located to src/config/services.php by default.

The following is a sample example:

'redis' => [
    'class' => blink\redis\Client::class,
    'servers' => ['tcp://127.0.0.1:6379'],
]

Once the redis service configured, we can access redis server through app()->redis in our application. As the Redis component is based on Predis, you can refer their documentation on how to issue command to redis servers.

Using redis as a cache service

The component provides a PSR-16 SampleCache implementation which using redis as a cache storage. We can define a cache service in services.php likes the folowing:

'cache' => [
    'class' => blink\redis\cache\SampleCache::class,
    'redis' => 'redis', // The redis service to store cached data
    'prefix' => '',     // The prefix of cached key
]

Once the cache service configured, we can access the cache service through app()->cache in our application.

Using redis as session storage

The component also provides a Session Storgae class which allows Blink to store application sessions into redis. we can configure the session storage in the following way:

'session' => [
    'class' => blink\session\Manager::class,
    'expires' => 3600 * 24 * 15,
    'storage' => [
        'class' => blink\redis\session\Storage::class,
        'redis' => 'redis',  // the redis service to store sessions
    ]
],

统计信息

  • 总下载量: 33.37k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-04-28