Statistics
228
0
1
7d
Badges
Tags
api
Dependencies

Latest Stable Version License Total Downloads Gitter

ublaboo/predis-client-nette-extension

Nette DIC extension for predis/predis client

Installation

Download extension using composer

composer require ublaboo/predis-client-nette-extension

Register extension in your config.neon file:

extensions:
    predisClient: Ublaboo\PredisClientNetteExtension\DI\PredisClientNetteExtension

Configuration

Configure extension in your config.neon file:

predisClient:
    uri: 'tcp://127.0.0.1:32768'
    options:
        prefix: 'fooPrefix:'
        # other options
    sessions: true # Whether to register redis session handler or not

Usage

<?php

declare(strict_types=1);

use Predis\Client;

class Foo
{

	/**
	 * @var Client
	 */
	public $redisClient;


	public function __construct(Client $redisClient)
	{
		$this->redisClient = $redisClient;
	}


	public function save(string $key, string $value): void
	{
		$this->redisClient->set($key, $value);
	}
	
	
	public function retrive(string $key): ?string
	{
		return $this->redisClient->get($key);
	}

}

No release at this moment. Try to create first one.

Is this addon outdated? Did you find an issue? Please report it.

Componette Componette admin@componette.com