00f100/fcphp-redis

该包最新版本(0.4.2)没有提供许可信息。

FcPhp 的 Redis 数据库

安装: 234

依赖: 1

建议: 0

安全: 0

星标: 1

关注者: 2

分支: 1

公开问题: 0

类型:package

0.4.2 2018-08-04 15:51 UTC

This package is not auto-updated.

Last update: 2024-09-19 19:03:43 UTC


README

用于管理 Redis 的包

Build Status codecov Total Downloads

如何安装

Composer

$ composer require 00f100/fcphp-redis

或者在 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