Skip to content
redis client with typescript and esnext for nodejs
TypeScript JavaScript Shell
Branch: master
Clone or download
dasoncheng readme update (#31)
* doname doc
* readme update
* 0.1.10
Latest commit e9d9e65 Nov 27, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode redis info stats (#28) Jul 12, 2019
doc readme update (#31) Nov 27, 2019
example redis info stats (#28) Jul 12, 2019
reference - init Aug 6, 2018
script doc update (#29) Nov 2, 2019
src redis info stats (#28) Jul 12, 2019
test redis info stats (#28) Jul 12, 2019
tools test (#16) Aug 15, 2018
types update (#17) Aug 15, 2018
.editorconfig - init Aug 6, 2018
.eslintrc.json - init Aug 6, 2018
.gitignore redis info stats (#28) Jul 12, 2019
.npmignore - package uuid (#22) Dec 18, 2018
.travis.yml redis info stats (#28) Jul 12, 2019
LICENSE - init Aug 6, 2018
README.md readme update (#31) Nov 27, 2019
docker-compose.yml test (#16) Aug 15, 2018
jest.config.js - character set expansion Feb 26, 2019
package.json readme update (#31) Nov 27, 2019
tsconfig.json update (#17) Aug 15, 2018
tsconfig.spec.json test update (#10) Aug 12, 2018
tslint.json - doc update (#6) Aug 9, 2018

README.md

tedis logo

travis issues license package Coverage Status tag
pr release languages size commit

Supporting Tedis

Introduction

What is tedis

Tedis write with typescript, it's the client of redis for nodejs, support async with ts and commonjs

Installation

yarn add tedis

Getting started

commonjs

const { Tedis, TedisPool } = require("tedis");

typescript

import { Tedis, TedisPool } from "tedis";
// no auth
const tedis = new Tedis({
  port: 6379,
  host: "127.0.0.1"
});

// auth
const tedis = new Tedis({
  port: 6379,
  host: "127.0.0.1",
  password: "your_password"
});

TedisPool

// no auth
const pool = new TedisPool({
  port: 6379,
  host: "127.0.0.1"
});

// auth
const pool = new TedisPool({
  port: 6379,
  host: "127.0.0.1",
  password: "your_password"
});
const tedis = await pool.getTedis();
// ... do some commands
pool.putTedis(tedis);

Example

/**
 * core
 */
await tedis.command("SET", "key1", "Hello");
// "OK"
await tedis.command("SET", "key2", "World");
// "OK"

/**
 * key
 */
await tedis.keys("*");
// []
await tedis.exists("a");
// 0

/**
 * string
 */
await tedis.set("mystring", "hello");
// "OK"
await tedis.get("mystring");
// "hello"

/**
 * hash
 */
await tedis.hmset("myhash", {
  name: "tedis",
  age: 18
});
// "OK"
await tedis.hgetall("myhash");
// {
//   "name": "tedis",
//   "age": "18"
// }

/**
 * list
 */
await tedis.lpush("mylist", "hello", "a", "b", "c", "d", 1, 2, 3, 4);
// 9
await tedis.llen("mylist");
// 9

Type interface

base

pool

key

string

hash

list

set

zset

You can’t perform that action at this time.