Socket
Book a DemoInstallSign in
Socket

bulk-node

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bulk-node

node.js client of bulkCache

0.1.3
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Node.js client of bulkCache

install

npm install bulk-node

useage

'use strict'

const bulkClient = require('bulk-node')

const bulk = bulkClient(['127.0.0.1:1128', '10.25.197.70:1128'])

//promise
const ps = []
for(let i = 0 ; i < 9; i++ ){
  ps.push(bulk.set('video_xxx', 'tag' + i, 120))
}

Promise.all(ps)
.then(r => bulk.getItems('user'))
.then(r => console.log(r))
.catch( console.error )

//callback
bulk.set('video_xxx', 'tag_xxxxx', 600, (err, r) => {
  if(!err) {
    bulk.getItems('user', (err, items) => console.log(items, err) )
  }
}) 

API

bulkClient(serverlist)

  • serverlist是一个服务器数组。返回一个bulk实例。
  • bulkCache通过客户端多写单读,实现简单的可靠性。

bulk.set(bulkname, value, expire, [callback])

  • 向bulk里写数据
  • bulkname => 桶名,不存在会自动创建
  • value => 保存的值
  • expire => 超时时间,单位秒
  • callback 可选
  • 返回promise

bulk.getItems(bulkname, [callback])

  • bulkname => 桶名
  • callback可选 (err, items) => {}
  • 返回promise

Keywords

bulkCache

FAQs

Package last updated on 26 Jul 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.