Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

refpool

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

refpool

Pool of references that gc the least recently unref'ed ones when it reaches a max size

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-85.71%
Maintainers
1
Weekly downloads
 
Created
Source

refpool

Pool of references that gc the least recently unref'ed ones when it reaches a max size

npm install refpool

Usage

const Pool = require('refpool')

const p = new Pool({
  maxSize: 42,
  close (data) {
    console.log('should close', data)
  }
})

const someResource = ...

p.add(data) // add it to the pool
p.increment(data) // add it and increment the reference count
p.decrement(data) // decrement the ref count
p.bump(data) // indicate that you used a thing in the pool

When more than maxSize items are inserted the least recently used resource with no references will be passed to close.

License

MIT

FAQs

Package last updated on 23 Jul 2020

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc