定制 lulco/redis-proxy 二次开发

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

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

lulco/redis-proxy

最新稳定版本:1.7.0

Composer 安装命令:

composer require lulco/redis-proxy

包简介

Library for Redis driver abstraction

README 文档

README

Library for creating redis instance depends on application / server possibilities

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight Latest Stable Version Total Downloads PHP 7 ready

Installation

Composer

The fastest way to install Redis proxy is to add it to your project using Composer (http://getcomposer.org/).

  1. Install Composer:
    curl -sS https://getcomposer.org/installer | php 
  2. Require Redis proxy as a dependency using Composer:
    php composer.phar require lulco/redis-proxy 
  3. Install Redis proxy:
    php composer.phar update 

Usage

Single redis node

$redis = new \RedisProxy\RedisProxy($host, $port); // Call redis methods $redis->select($database); $redis->hset($key, $field, $value); $redis->hlen($key); $redis->hget($key, $field); $redis->hgetall($key); ...

Sentinel

$sentinels = [ ['host' => '172.19.0.5', 'port' => 26379], ['host' => '172.19.0.6', 'port' => 26379], ['host' => '172.19.0.7', 'port' => 26379], ]; $clusterId = 'mymaster'; $redis = new \RedisProxy\RedisProxy(); $redis->setSentinelConnectionPool($sentinels, $clusterId, $database); // Call redis methods $redis->hset($key, $field, $value); $redis->hlen($key); $redis->hget($key, $field); $redis->hgetall($key);

Multi read connection

Read from multiple redis nodes Write to one master redis node

$master = ['host' => '172.19.0.5', 'port' => 26379]; $slaves = [ ['host' => '172.19.0.5', 'port' => 26379], ['host' => '172.19.0.6', 'port' => 26379], ['host' => '172.19.0.7', 'port' => 26379], ]; $clusterId = 'mymaster'; $redis = new \RedisProxy\RedisProxy(); $redis->setMultiConnectionPool($master, $slaves);

Multi write connection

Write to multiple master redis nodes Optionally read from multiple redis nodes

$masters = [ ['host' => '172.19.0.5', 'port' => 26379], ['host' => '172.19.0.6', 'port' => 26379], ['host' => '172.19.0.7', 'port' => 26379], ]; $slaves = [ ['host' => '172.19.0.5', 'port' => 26379], ['host' => '172.19.0.6', 'port' => 26379], ['host' => '172.19.0.7', 'port' => 26379], ]; $clusterId = 'mymaster'; $redis = new \RedisProxy\RedisProxy(); $redis->setMultiWriteConnectionPool($masters, $slaves);

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固