Socket
Socket
Sign inDemoInstall

ee-ttl-queue

Package Overview
Dependencies
5
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ee-ttl-queue

Queue with timeout


Version published
Weekly downloads
2
decreased by-60%
Maintainers
1
Install size
156 kB
Created
Weekly downloads
 

Readme

Source

ee-ttl-queue

Queue with timeout function

installation

npm install ee-ttl-queue

build status

Build Status

usage

var Queue = require( "ee-ttl-queue" )
	. log = require( "ee-log" );


// create a queue wich cannot hold more than 9 items at the time
// the items added to the queue will timeout if they are not 
// retreived via the .get() api.
// the timeout event will emit the items which are timed out.
// the error event will be invoked if the queue is overflowing, 
// which is in this case when the 10th item is added.

var q = new Queue( { 
	  ttl: 1000
	, max: 9 
	, on: {
		timeout: function( item ){ log( item ); }
		, error: function( err, item ){ log( err ); }
	}
} );


// you may queue any type of variable, return true when the item was queued
var itemWasAdded = q.queue( whatever );

// alternative syntax
var itemWasAdded = q.add( whatever );

// you may remove items again
q.remove( whatever );

// retreive the oldest item
var item = q.get();

Keywords

FAQs

Last updated on 19 Jan 2015

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc