微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ioredis Node.js 的 Redis 客户端

程序名称:ioredis

授权协议: MIT

操作系统: 跨平台

开发语言: JavaScript

ioredis 介绍

ioredis一个用于 Node.js/io.js 的 Redis 客户端,强健、功能强大且全面。

要求 Redis >= 2.6.12 ,Node.js >= 0.10.16)

具有以下特性

  • 功能完备。支持 Cluster, Sentinel, Pipelining,以及 Lua scripting & Pub/Sub(同时支持二进制消息)

  • 性能

  • 友好的 API,支持使用 Node callbacks 以及 Bluebird promises

  • 抽象 Lua 脚本,可定义自定义命令

  • 支持二进制数据

  • 支持 TLS

  • 支持离线队列和准备检查

  • 支持 ES6 类型,例如 Map and Set

  • 支持 GEO 命令(Redis 3.2 Unstable)

  • 完善的错误处理策略

示例代码 - 基本用法

var Redis = require('ioredis');
var redis = new Redis();
redis.set('foo', 'bar');
redis.get('foo', function (err, result) {
  console.log(result);
});
// Or using a promise if the last argument isn't a function
redis.get('foo').then(function (result) {
  console.log(result);
});
// Arguments to commands are flattened, so the following are the same:
redis.sadd('set', 1, 3, 5, 7);
redis.sadd('set', [1, 3, 5, 7]);
// All arguments are passed directly to the redis server:
redis.set('key', 100, 'EX', 10);

ioredis 官网

https://github.com/luin/ioredis

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐