redisent/redis
Composer 安装命令:
composer require redisent/redis
包简介
A simple, no-nonsense interface to the Redis for modest developers. It is designed to be flexible and tolerant of changes to the Redis protocol
README 文档
README
Redisent is a simple, no-nonsense interface to the Redis data structure store for modest developers. It is designed to flexible and tolerant of changes to the Redis protocol.
Introduction
If you're at all familiar with the Redis protocol and PHP objects, you've already mastered Redisent. Redisent translates method calls to their Redis protocol equivalent, abstracting away the nitty-gritty, and then makes the return values PHP compatible.
Features
Shared Redis API
The Redisent method names map directly to their Redis command counterparts. The full list is available in the command reference.
Setting Keys
$redis->set('foo', 'bar') // SET foo bar
Working with lists
$redis->lpush('particles', 'electron') // LPUSH particles electron $redis->lpush('particles', 'proton') // LPUSH particles proton $redis->lpush('particles', 'neutron') // LPUSH particles neutron $redis->llen('particles') // LLEN particles
Pipelining
Redisent provides a fluent interface for pipelining commands to Redis.
$redis->pipeline() ->set('X', 2) ->incr('X') ->incr('X') ->uncork(); // #=> array containing the responses of each command
Quick Start
Redisent has no dependencies aside from requiring PHP versions 5.3 and later. To add it to your project, simply drop the Redis.php file into your project structure, instantiate a Redis instance, and start issuing commands.
require_once 'redisent/Redis.php'; $redis = new redisent\Redis('redis://localhost'); $redis->set('awesome', 'absolutely'); echo "Is Redisent awesome? ", $redis->get('awesome'), "\n";
Any errors originating from Redis will be wrapped in a resident\RedisException and thrown.
Pipelining
Redisent supports a fluent interface for pipelining.
A pipeline is started by calling the pipeline method on a Redis instance, using Redisent as usual, and then calling the uncork method.
The uncork method returns an array of the responses of the pipelined commands.
Example
$redis = new Redisent\Redis(); $responses = $redis->pipeline() ->incr('X') ->incr('X') ->incr('X') ->incr('X') ->uncork(); print_r($responses);
If the key X didn't exist, the first INCR would create it and return 1, and successive calls would increment it by 1.
The return value of the call to uncork() would be array(1,2,3,4), the responses of each INCR command.
Contributing
Pull requests please! Feature/topic branches are especially appreciated.
Unit tests are written with SimpleTest, please include tests in your pull request.
To run tests, run sh setup.sh script to get set up and then php tests/all_tests.php to run the suite.
Roadmap
Redis has grown to be very feature rich, and Redisent is lagging behind.
- Publish/subscribe
- Transactions
About
Copyright © 2009-2012 Justin Poliey
License
Licensed under the ISC License.
Copyright (c) 2009-2012 Justin Poliey justin@getglue.com
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
redisent/redis 适用场景与选型建议
redisent/redis 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 29.49k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2013 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nosql」 「redis」 「redisent」 「key value store」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 redisent/redis 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 redisent/redis 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 redisent/redis 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The DreamFactory(tm) CouchDB Service.
Microservice RPC through message queues.
The CodeIgniter Redis package
贝嘟分布式缓存扩展
Symfony lock Tarantool store
Redis distributed locks for laravel
统计信息
- 总下载量: 29.49k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: ISC
- 更新时间: 2013-01-04