00f100 / fcphp-redis
此包的最新版本(0.4.2)没有提供许可证信息。
FcPhp的Redis数据库
0.4.2
2018-08-04 15:51 UTC
Requires
- php: >=7.2
- ext-redis: *
Requires (Dev)
- 00f100/phpdbug: *
- phpunit/phpunit: 6.*
This package is not auto-updated.
Last update: 2024-09-19 19:03:43 UTC
README
用于管理Redis的包
如何安装
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