ublaboo / predis-client-nette-extension
A Nette extension for the AWS SDK for PHP http://aws.amazon.com/sdkforphp/
Installs: 34 669
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 1
Open Issues: 1
Requires
- nette/di: ^3.0
- predis/predis: ^1.1
Requires (Dev)
This package is auto-updated.
Last update: 2024-12-09 22:56:17 UTC
README
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 sessionsTtl: null # Seconds or null (null = ini_get('session.gc_maxlifetime'))
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); } }