Skip to content

设置值


set()

设置存储在给定键中的值。RDb() 可以传入一个数据源的名称,默认是第一个数据源

  • @param key
  • @param value
  • @param timeout 过期时间
  • @param callback 过期后的回调
  • (key: string, value: string | DBOBJECT, timeout: number = 0, callback?: () => void)

set()

import { Controller, RDb } from 'think-ts-lib'

export default class HelloController extends Controller {

  sayHello() {
    RDb().set('order_id_789', '2021051011365489', 3000, () => {
      console.log('订单过期,改变订单状态')
    })
    return ShowSuccess(true)
  }

}
import { Controller, RDb } from 'think-ts-lib'

export default class HelloController extends Controller {

  sayHello() {
    RDb().set('order_id_789', '2021051011365489', 3000, () => {
      console.log('订单过期,改变订单状态')
    })
    return ShowSuccess(true)
  }

}

备案号:冀ICP备20015584号-2