think-redis2
v1.0.1
Published
Redis for ThinkJS
Downloads
3
Readme
Redis for ThinkJS
// src/config/extend.ts
const redis = require('think-redis2');
import {think} from 'thinkjs';
module.exports = [
redis(think.app),
];
// src/controller/index.ts
import Base from './base.js';
import {think} from 'thinkjs';
export default class extends Base {
async setAction() {
const redis = this.redis();
redis.set("some", 123);
this.body = "OK";
}
async getAction() {
const redis = this.redis();
const some = await redis.get("some");
this.body = some; // 123
}
}