YEPS ioredis
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
tests
.editorconfig
.eslintrc.json
.gitignore
.istanbul.yml
.travis.yml
LICENSE
README.md
appveyor.yml
index.js
package.json
redis.js

README.md

YEPS ioredis

YEPS Promise based redis client

NPM

npm version Build Status Coverage Status Linux Build Windows Build

Dependency Status devDependency Status NSP Status

License GitHub stars GitHub forks GitHub issues Twitter

How to install

npm i -S yeps-redis

How to use

Config

config/default.json

{
  "redis": {
    "host": "127.0.0.1",
    "port": 6379
  }
}

Middleware

const App = require('yeps');
const Router = require('yeps-router');

const redis = require('yeps-redis');

const error = require('yeps-error');
const logger = require('yeps-logger');

const server = require('yeps-server');

const app = new App();
const router = new Router();

app.all([
    error(),
    logger(),
    redis(),
]);

app.then(async ctx => {
    await ctx.redis.set('data', 'test');
    const data = await ctx.redis.get('data');
});

router.get('/url').then(async ctx => {
    await ctx.redis.set('data', 'test');
    const data = await ctx.redis.get('data');
    
    ctx.res.statusCode = 200;
    ctx.res.end(data); 
});

app.then(router.resolve());

server.createHttpServer(app);

Module

const redis = require('yeps-redis/redis');

async () => {
    await redis.set('test', 'test');
    const data = await redis.get('test');
}

YEPS documentation

Dependencies: