hmget & hmset
1. 基本語法
(1) hmset(hkey ,subkey, value[, subkey, value, ...], callback)
hkey ,subkey, value[, subkey, value, ...], callback) 為hkey一次設置多組subkey與value的鍵值對資料。
(2) hmget(hkey , subkey[, subkey, ...],callback)
hkey , subkey[, subkey, ...],callback) 回傳hkey底下多組subkey對應的資料內容。
const dict = {
name: 'Brooks Hatlen',
gender: 'M',
age: '73'
};
client.hmset('user:2', dict);
client.hmget('user:2', 'name', 'age', (err, vals) => {
console.log(vals);
});[ 'Brooks Hatlen', '73' ]Last updated
Was this helpful?