2017 © Pedro Peláez
 

symfony-bundle redis-bundle

bundle sf2 on top of predis

image

m6web/redis-bundle

bundle sf2 on top of predis

  • Thursday, July 5, 2018
  • by M6Web
  • Repository
  • 23 Watchers
  • 8 Stars
  • 165,607 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 4 Forks
  • 3 Open issues
  • 50 Versions
  • 5 % Grown

The README.md

RedisBundle

Build Status Latest Stable Version Total Downloads License PHP Version Require, (*1)

symfony Bundle on top of predis, (*2)

see predis/predis, (*3)

features

  • semantic configuration
  • sf event dispatcher integration
  • session handler with redis storage : M6Web\Bundle\RedisBundle\Redis\RedisSessionHandler
  • redis adapter for guzzle cache : M6Web\Bundle\RedisBundle\Guzzle\RedisCacheAdapter
  • dataCollector for sf2 web profiler toolbar

usage

configuration

in config.yml for a simple cache service :, (*4)

m6web_redis:
    servers:
        default:
            host:   'localhost'
            port: 6379
            reconnect: 1
    clients:
        default:
            servers:   ["default"]     # list of servers to use
            prefix:    raoul\          # prefix to use
            timeout:   2               # timeout in second
            read_write_timeout: 2      # read-write timeout in second

for a multiple clients :, (*5)

m6web_redis:
    servers:
        first:
            host:   'localhost'
            port: 6379
            reconnect: 1
        second:
            host:   'xxxxxxxx'
    clients:
        default:
            servers:   ["first"]     # list of servers to use
            prefix: raoul\           # prefix to use
            timeout:   2             # timeout in second (float)
            read_write_timeout: 1.2  # read write timeout in seconds (float)
            compress: true           # compress/uncompress data sent/retrieved from redis using gzip, only method SET, SETEX, SETNX, GET, MGET and MSET are supported
        sharded:
            servers: ["first", "second"]
            prefix: raaaoul\
            timeout:   1

$this->get('m6web_redis') send the default client. this->get('m6web_redis.sharded') the sharded one., (*6)

list of options in servers configuration

  • host: IP address or hostname of Redis.
  • port: CP port on which Redis is listening to. Default value 6379
  • database: Database index (see the SELECT command).
  • scheme: Connection scheme, such as 'tcp' or 'unix'. Default value tcp
  • async_connect: Performs the connect() operation asynchronously. Default value false
  • persistent: Leaves the connection open after a GC collection. Default value false
  • timeout: Timeout for the connect() operation. Default value 10
  • read_write_timeout: Timeout for read() and write() operations
  • reconnect: Number of reconnection attempt if a redis command fail, only for tcp
m6web_redis:
    servers:
        server1:
            host:   'localhost'
            port: 6379

server configuration via wildcard

m6web_redis:
    servers:
        server1:
            host:   'localhost'
            port: 6379
        server2:
            host:   'xxxxxxxx'
    clients:
        default:
            servers:   ["server*"]     # all servers matching server*
            prefix: raoul\
            timeout:   2

event dispatcher

The event M6Web\Bundle\RedisBundle\EventDispatcher\RedisEvent is automaticly dispatched when a command is executed. Events are fired with the redis.command label., (*7)

You can customize the event name through the client configuration :, (*8)

```yml m6web_redis: clients: default: eventname: myEventName, (*9)


### session handler

app/config/config.yml

framework: session: # ... handler_id: session.handler.redis, (*10)

m6web_redis: servers: first: ip: 'localhost' port: 6379 clients: sessions: servers: ["first"] prefix: sessions\ timeout: 1, (*11)

services: session.handler.redis: class: M6Web\Bundle\RedisBundle\Redis\RedisSessionHandler public: false arguments: - '@m6web_redis.sessions' - 3600, (*12)


### dataCollector Datacollector is available when the Symfony profiler is enabled. The collector allow you to see the following Redis data: - Command name - Execution time - Command arguments ### overwriting base class

m6web_redis: clients: default: servers: ["first"] type: ["db"] timeout: 0.5 class: \MyCompany\Redis, (*13)


#### guzzle redis cache adapter ```yml m6web_redis: clients: guzzlehttp: servers: ["first"] prefix: GuzzleHttp\ class: M6Web\Bundle\RedisBundle\CacheAdapters\M6WebGuzzleHttp timeout: 1

Launch Unit Tests

bin/atoum

Launch php cs

    make cs-ci
    make cs-fix

The Versions

05/07 2018

dev-fix/connection-one-server

dev-fix/connection-one-server

bundle sf2 on top of predis

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

22/03 2018

dev-fix/M6WebGuzzleHttp_CacheAdapter

dev-fix/M6WebGuzzleHttp_CacheAdapter

bundle sf2 on top of predis

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

05/03 2018
05/03 2018

dev-fix/default-configuration

dev-fix/default-configuration

bundle sf2 on top of predis

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

01/03 2018
01/02 2018

dev-feature/use-predis

dev-feature/use-predis

bundle sf2 on top of predis

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

14/12 2017

dev-fix/profiler

dev-fix/profiler

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

31/07 2017
01/12 2016

v2.5.0

2.5.0.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

29/01 2016

v2.4.1

2.4.1.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

23/06 2015

v2.4.0

2.4.0.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

06/03 2015

v2.3.0

2.3.0.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

06/03 2015

v2.2.1

2.2.1.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

18/02 2015
18/02 2015

dev-feature/retry-on-error

dev-feature/retry-on-error

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

18/12 2014

dev-feature/use-predis-directly

dev-feature/use-predis-directly

bundle sf2 on top of predis

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

09/12 2014

v2.1.0

2.1.0.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

04/12 2014

v2.0.1

2.0.1.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

07/11 2014

v2.0.0

2.0.0.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

14/10 2014

v1.3.0

1.3.0.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

29/09 2014

v1.2.3

1.2.3.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

29/09 2014

dev-feature/redis-adapter-guzzle4

dev-feature/redis-adapter-guzzle4

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

18/08 2014

v1.2.2

1.2.2.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

07/08 2014

v1.2.1

1.2.1.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

06/08 2014

dev-feature/better-timeout-configuration

dev-feature/better-timeout-configuration

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

15/07 2014

v1.2.0

1.2.0.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

17/06 2014

v1.1.4

1.1.4.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

17/06 2014

v1.1.3

1.1.3.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

13/06 2014

v1.1.2

1.1.2.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

12/06 2014

v1.1.1

1.1.1.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

12/06 2014

v1.1.0

1.1.0.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

06/06 2014

v1.0.11

1.0.11.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

04/06 2014

v1.0.10

1.0.10.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

04/06 2014

v1.0.9

1.0.9.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

04/06 2014

v1.0.8

1.0.8.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

03/06 2014

v1.0.7

1.0.7.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

27/05 2014

v1.0.6

1.0.6.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

23/05 2014

v1.0.5

1.0.5.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

16/05 2014

v1.0.4

1.0.4.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

06/05 2014

v1.0.3

1.0.3.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

06/05 2014

v1.0.2

1.0.2.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

06/05 2014

dev-fix/ttl-null

dev-fix/ttl-null

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

28/04 2014

v1.0.1

1.0.1.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour

14/03 2014

v1.0.0

1.0.0.0

bundle sf2 on top of m6web/redis-component

  Sources   Download

The Requires

 

The Development Requires

by Olivier Mansour