Package to manage Redis
Composer:
$ composer require 00f100/fcphp-redisor add in composer.json
{
"require": {
"00f100/fcphp-redis": "*"
}
}<?php
/**
* Method to construct instance of Redis
*
* @param string $host Host to connect Redis server
* @param string $port Port of Redis server
* @param string $password Password of Redis server
* @param int $timeout Timeout of try connect
* @return void
*/
$redis = RedisFacade::getInstance(string $host, string $port, string $password = null, int $timeout = 100);<?php
use FcPhp\Redis\Facades\RedisFacade;
$redis = RedisFacade::getInstance('127.0.0.1', '6379', null, 100);
$redis->set('key', 'content');
echo $redis->get('key');
// Print: content
print_r($redis->keys('*'));
// List all keus into array
$redis->delete('key');
// Delete key