2017 © Pedro Peláez
 

library redis

A redis component for the Blink framework

image

blink/redis

A redis component for the Blink framework

  • Wednesday, July 26, 2017
  • by bixuehujin
  • Repository
  • 1 Watchers
  • 2 Stars
  • 196 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 23 % Grown

The README.md

A Redis component for the Blink Framework

Build Status Latest Stable Version Latest Unstable Version, (*1)

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:, (*2)

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., (*3)

The following is a sample example:, (*4)

'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., (*5)

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:, (*6)

'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., (*7)

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:, (*8)

'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
    ]
],

The Versions

26/07 2017

dev-master

9999999-dev

A redis component for the Blink framework

  Sources   Download

MIT

The Requires

 

The Development Requires

cache redis blink