00f100 / fcphp-redis
Redis Database for FcPhp
Installs: 257
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Type:package
Requires
- php: >=7.2
- ext-redis: *
Requires (Dev)
- 00f100/phpdbug: *
- phpunit/phpunit: 6.*
This package is not auto-updated.
Last update: 2024-11-14 19:40:28 UTC
README
Package to manage Redis
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