🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## set 设置存储在给定键中的值 * key 键 * val 值 * timeout 过期时间 默认不设置 * callback 过期后执行的事件函数,其中 ``key`` 代表过期的那个键名 ``` const Controller = require('think-js-lib').Controller class HelloController extends Controller { // 用于演示 restful api 接口功能 sayHello(ctx) { this.RDb().set('order_id_789','2021051011365489',3000,(key) => { // key 就是 order_id_789 console.log('订单过期,改变订单状态') }) return this.showSuccess(true) } } module.exports = HelloController ``` > 无返回值,无需使用 ``async`` ``await``