Skip to main content
Winter Data Redis is a module that provides easy configuration and access to Redis from Winter Boot applications. It supports single nodes, Redis Cluster, Redis Arrays, Redis Sentinel, and token-based ring topologies such as Netflix Dynomite through the PhpRedis extension.
This is a CLIENT module that connects to existing Redis servers. If you want the framework to launch and manage an embedded Redis server, use the Memdb module instead.

Setup

Append the following code to your application.yml:

Implementation

PHP has two very good libraries that can be used to work with Redis:
  1. PhpRedis - C Extension
  2. Predis - Pure PHP Implementation
This module assumes that you have the PhpRedis extension already installed.
If you are interested in using Predis, contributions for a PredisTemplate are welcomed.

Autowired Services

This module provides the following services automatically available to you.

1. PhpRedisTemplate

Use PhpRedisTemplate when dealing with single Redis node(s).

Configuration for PhpRedisTemplate (redis-config.yml)

PHP Example

2. PhpRedisClusterTemplate

Use PhpRedisClusterTemplate when dealing with Redis Cluster.
If you are interested in using Predis, contributions for a PredisClusterTemplate are welcomed.

Configuration for PhpRedisClusterTemplate (redis-config.yml)

PHP Example

3. PhpRedisArrayTemplate

Use PhpRedisArrayTemplate when dealing with Redis Arrays.

Configuration for PhpRedisArrayTemplate (redis-config.yml)

PHP Example

4. PhpRedisSentinelTemplate

Use PhpRedisSentinelTemplate when dealing with Redis Sentinel.

Configuration for PhpRedisSentinelTemplate (redis-config.yml)

PHP Example

5. PhpRedisTokenTemplate

Use PhpRedisTokenTemplate when dealing with token-based ring topology Redis clusters such as Netflix Dynomite.

Configuration for PhpRedisTokenTemplate (redis-config.yml)

PHP Example