获取值
get()
获取存储在给定键中的值,需要传入一个键名。RDb()
需要传入一个数据源配置
const redisConfig = {
host: '127.0.0.1',
port: 6379,
db: 0
}
const redisConfig = {
host: '127.0.0.1',
port: 6379,
db: 0
}
- @param
key
键 - (key: string)
get()
import { RDb } from 'think-ts-db'
export default defineEventHandler(async (event) => {
const token = await RDb(redisConfig).get('token')
return token
})
import { RDb } from 'think-ts-db'
export default defineEventHandler(async (event) => {
const token = await RDb(redisConfig).get('token')
return token
})