PHP-Redis-implementation

Raw wrapper for real Redis fans.

  • 所有者: ziogas/PHP-Redis-implementation
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

PHP Redis implementation V2.1

Yet another php redis implementation.
Raw wrapper for real Redis fans. Main advantages:

  • Doesn't require any dependencies as all the communication goes via tcp socket.
  • All commands are passed as is, so you have all the freedom to play with redis just like in redis-cli.
  • It won't get deprecated or obsolete for the same reason. You write raw commands by yourself.
  • Doesn't matter which redis version you have.
  • Supports chainable methods. Write multiple commands and send everything at once.
  • Custom error function to handle errors.
  • Dead Simple and lightweight, you're welcome to read all the 300+ lines of redis.php
  • Forces you to actually learn and understand redis data structures and commands.

Download

You can checkout latest version with:

$ git clone git://github.com/ziogas/PHP-Redis-implementation

Install

To install PHP redis:

  • Simply copy redis.php to your site and require it from external script

Here are some examples:

require 'redis.php';

function redis_error($error) {
    throw new error($error);
}

$redis = new redis_cli ();
$redis->set_error_function('redis_error');

$redis->cmd('SET', 'foo', 'bar')
      ->cmd('HSET', 'hash', 'field', 'val')
      ->cmd('EXPIRE', 'foo', 300)
      ->set();

$foo = $redis->cmd('GET', 'foo')->get();
$field = $redis->cmd('HGET', 'hash', 'field')->get();

var_dump($foo);
var_dump($field);

More usage examples can be found on tests folder.
For commands documentation just go directly to https://redis.io/commands

Running tests

To run tests you'll need phpunit

Execute:
phpunit tests/*

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

Author

Arminas Zukauskas - arminas@ini.lt

Based on http://redis.io/topics/protocol

License

MIT Do whatever you want, attribution is nice but not required

主要指标

概览
名称与所有者ziogas/PHP-Redis-implementation
主编程语言PHP
编程语言PHP (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2011-01-26 20:49:16
推送于2017-06-06 07:16:29
最后一次提交2017-06-06 10:16:28
发布数0
用户参与
星数52
关注者数8
派生数24
提交数28
已启用问题?
问题数2
打开的问题数0
拉请求数2
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?