redis/redis_test.js
2024-11-13 17:08:47 +08:00

14 lines
386 B
JavaScript

import redis from 'apigo.cc/gojs/redis'
import co from 'apigo.cc/gojs/console'
redis.setDefault('redis://127.0.0.1:6379/2')
redis.set('aaa', 111)
let r = redis.get('aaa')
if (r !== 111) return 'failed to get value ' + r
redis.hMSet('bbb', 'b1', 111, 'b2', 222)
let [b1, b2] = redis.hMGet('bbb', 'b1', 'b2')
if (b1 !== 111 || b2 !== 222) return 'failed to get hash value'
return true