00f100/fcphp-redis

There is no license information available for the latest version (0.4.2) of this package.

Redis Database for FcPhp

0.4.2 2018-08-04 15:51 UTC

This package is not auto-updated.

Last update: 2024-11-14 19:40:28 UTC


README

Package to manage Redis

Build Status codecov Total Downloads

How to install

Composer:

$ composer require 00f100/fcphp-redis

or add in composer.json

{
    "require": {
        "00f100/fcphp-redis": "*"
    }
}

How to use

<?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);

Example

<?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