plugins/tests/redis_test.js

22 lines
631 B
JavaScript
Raw Normal View History

2024-06-26 12:17:41 +08:00
import redis from "apigo.cc/apigo/plugins/redis"
2024-03-24 12:28:02 +08:00
redis.set('aaa', 111)
let aaa = redis.get('aaa')
if(aaa !== 111) throw new Error('aaa is '+aaa+' not 111')
redis.set('bbb', '222')
let bbb = redis.get('bbb')
if(bbb !== 222) throw new Error('bbb is '+bbb+' not 222')
redis.set('bbb', 'b222')
bbb = redis.get('bbb')
if(bbb !== 'b222') throw new Error('bbb is '+bbb+' not b222')
let rd = redis.fetch("bak")
rd.hSet("hh", "aaa", "111")
rd.hSet("hh", "bbb", "b222")
let hh = rd.hGetAll("hh")
if(hh.aaa !== 111) throw new Error('hh.aaa is '+hh.aaa+' not 111')
if(bbb !== 'b222') throw new Error('bbb is '+bbb+' not b222')
return true