定制 makise-co/redis 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

makise-co/redis

Composer 安装命令:

composer require makise-co/redis

包简介

Makise-Co Adapter of PHP Redis extenstion

README 文档

README

Makise-Co Adapter of PHP Redis extenstion

Usage

WARNING: This package can be used only in the Swoole Coroutine context

INFO: To get non-blocking Redis connection you should call \Swoole\Runtime::enableCoroutine();

<?php

declare(strict_types=1);

$pool = new \MakiseCo\Redis\RedisPool(
    // pass standard redis extension connect parameters
    \MakiseCo\Redis\ConnectionConfig::fromArray([
        'host' => '127.0.0.1',
        'port' => 6379,
        'database' => 0,
//        'password' => 'secret',
        'options' => [
            \Redis::OPT_SERIALIZER => \Redis::SERIALIZER_MSGPACK,
        ]
    ]),
);

// initialize connection pool
$pool->init();

$pool->set('key', 'value');
$pool->del('key');
$pool
    ->multi()
    ->set('key', 'value')
    ->exec();

// However pool cannot be used as \Redis instance for this purpose you should use RedisLazyConnection
// RedisLazyConnection is a pool wrapper that extends \Redis class

$lazyConnection = new \MakiseCo\Redis\RedisLazyConnection($pool);
$lazyConnection->set('key', 'value');
$lazyConnection->del('key');

$lazyConnection
    ->multi()
    ->set('key', 'value')
    ->exec();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固