
Security News
Suno Breached via Shai-Hulud Worm, Leaked Code Exposes AI Music Scraping
A Shai-Hulud infection exposed Suno's source code, which shows the AI music startup stream-ripped tracks to train its models.
node-redis-h
Advanced tools
use npm install
使用 npm 安装
npm install node-redis-h
download form GitHub
从 github下载
对 node 的 redis 模块常规方法进行封装,支持 promise 风格的写法
//初始化连接客户端,ip,端口,连接密码
var client = require("node-redis-h").init(ip,port,password);
console.log(client);
var a = {
name:"xxx",
value:"222",
obj:{
onbj:"xx",
obj2:{
aa:"xxx"
}
}
};
// //stirng
// 命令 行为 返回值 使用示例(略去回调函数)
// set 设置存储在给定键中的值 OK set('key', 'value')
// get 获取存储在给定键中的值 value/null get('key')
// mset 获取存储在给定键中的值 value/null mset(['key1',value1,'key2',value2])
// mget 获取存储在给定键中的值 value/null mget(['key1','key2'])
// del 删除存储在给定键中的值(任意类型) 1/0 del('key')
client.set('hello',a)
.then(function(result){
console.log("set",result);
})
client.get('hello')
.then(function(result){
console.log("get",result);
})
client.mset(['hello',a,'hello1',a])
.then(function(result){
console.log("set",result);
})
client.mget(['hello','hello1'])
.then(function(result){
console.log("get",result);
})
client.del('list')
.then(function(result){
console.log("del",result);
})
// //list
// 命令 行为 返回值 使用示例
// lpush 将给定值推入列表的左端 当前列表长度 rpush('key', 'value1' [,'value2']) (支持数组赋值)
// rpush 将给定值推入列表的右端 当前列表长度 rpush('key', 'value1' [,'value2']) (支持数组赋值)
// lrange 获取列表在给定范围上的所有值 array lrange('key', 0, -1) (返回所有值)
// lindex 获取列表在给定位置上的单个元素 lindex('key', 1)
// lpop 从列表左端弹出一个值,并返回被弹出的值 lpop('key')
// rpop 从列表右端弹出一个值,并返回被弹出的值 rpop('key')
// llen 获取列表长度 llen('key')
// ltrim 将列表按指定的index范围裁减 ltrim('key', 'start', 'end')
client.lpush('list','left')
.then(function(result){
console.log("lpush",result);
})
client.rpush('list','right')
.then(function(result){
console.log("rpush",result);
})
client.lpush('list','left2')
.then(function(result){
console.log("lpush",result);
})
client.lpop('list')
.then(function(result){
console.log("lpop",result);
})
client.llen('list')
.then(function(result){
console.log("llen",result);
})
client.lrange('list',0,4)
.then(function(result){
console.log("llen",result);
})
client.lindex('list',5)
.then(function(result){
console.log("llen",result);
})
client.ltrim('list',0,4)
.then(function(result){
console.log("llen",result);
})
// hmset 在一个key中存入一系列键值对
// hgetall 通过key获取存储着的一系列键值对
client.hmset('testhash',["key4","hhh"])
.then(function(result){
console.log("hmset",result);
})
client.hmset('testhash',{1:1,2:2})
.then(function(result){
console.log("hmset",result);
})
client.hmget('testhash',["1","2"])
.then(function(result){
console.log("h,get",result);
})
client.hgetall('testhash')
.then(function(result){
console.log("hgetall",result);
})
// hset 在散列里面关联起给定的键值对 1(新增)/0(更新) hset('hash-key', 'sub-key', 'value') (不支持数组、字符串)
client.hset('testhash')
.then(function(result){
console.log("hset",result);
})
// hget 获取指定散列键的值 hget('hash-key', 'sub-key')
client.hget('testhash')
.then(function(result){
console.log("hget",result);
})
// hdel 删除指定散列键的值 hdel('hash-key', 'sub-key')
client.hdel('testhash')
.then(function(result){
console.log("hdel",result);
})
// hexists 检查给定键是否在散列中 1/0 hexists('hash-key', 'sub-key')
client.hexists('testhash')
.then(function(result){
console.log("hexists",result);
})
FAQs
基于redis的promise封装
The npm package node-redis-h receives a total of 354 weekly downloads. As such, node-redis-h popularity was classified as not popular.
We found that node-redis-h demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A Shai-Hulud infection exposed Suno's source code, which shows the AI music startup stream-ripped tracks to train its models.

Security News
Vercel is formalizing a monthly release program for Next.js. The change follows React2Shell and a sharp rise in AI-assisted vulnerability discovery.

Research
/Security News
11 malicious NuGet tools pose as game cheats to deploy Windows payloads, track hosts, and use Google Sheets for telemetry and control.