mfonte/redisw 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mfonte/redisw

最新稳定版本:v1.0.6

Composer 安装命令:

composer require mfonte/redisw

包简介

A Redis Client implementation library, built on top of the phpredis PECL package.

README 文档

README

Just another Redis Wrapper, around the https://github.com/phpredis/phpredis extension.

Latest Stable Version Total Downloads

Installation

Simple enough.

composer require mfonte/redisw

Required environment:

  1. PHP >= 8.1
  2. ext-redis module
  3. optional (but recommended) : igbinary support for better serialization

Basic Usage

Usage is simple enough with a nice, expressive API:

<?php
use Mfonte\Redisw\RedisClient as Redisw;

try {
    $client = Redisw::instance([
        'host' => '127.0.0.1', 
        'port' => 6379, 
        'connect_timeout' => 1, // optional
        'connect_tries' => 10, // optional
        'persistent' => true, // optional
        'db_index' => 1, // optional
        'cache_ttl' => 60, // optional. Defaults to 60 sec.
        'auth_password' => '', // optional
        'ssl' => '', // optional
        'key_prefix' => 'some_prefix', // optional
        'serializer' => 'ibginary', // optional. One of: igbinary, json, php
        'compression' => 'lzf', // optional. One of: lzf, zstd, lz4
    ]);

    // set a key
    $client->set('somekey', ['value', 'value', 'value']);

    // get a key
    $value = $client->get('somekey');
}
catch(\Exception $ex) {
    echo "Something got wrong: {$ex->getMessage()}";
}

// don't want exceptions while setting/getting/whatever?
$client->wrap('set', 'wont-throw-exceptions', [1, 2, 3, 4]);

$value = $client->wrap('get', 'wont-throw-exceptions');

Testing

Simply run composer install over this module's installation directory.

Then, run composer test to run all the tests.

Thank you's

A big thank you goes to https://github.com/alxmsl for his base implementation on https://github.com/alxmsl/Redis. This package heavily relies on his work.

Another big thank you goes to https://github.com/ukko for his phpredis extension autocomplete on https://github.com/ukko/phpredis-phpdoc. This package was easier to be written thanks to his work.

统计信息

  • 总下载量: 41
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2023-03-21