Skip to content

设置值(哈希)


hmset()

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

  • @param index 索引
  • @param value 键值对
  • @param timeout 过期时间
  • @param callback 过期后的回调
  • (index: string, value: DBOBJECT, timeout: number = 0, callback?: () => void)

hmset()

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

export default class HelloController extends Controller {

  sayHello() {
    RDb().set('coupons', { coupons_1: 10, coupons_2: 20 }, 3000, () => {
      console.log('优惠劵过期')
    })
    return ShowSuccess(true)
  }

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

export default class HelloController extends Controller {

  sayHello() {
    RDb().set('coupons', { coupons_1: 10, coupons_2: 20 }, 3000, () => {
      console.log('优惠劵过期')
    })
    return ShowSuccess(true)
  }

}

备案号:冀ICP备20015584号-2