limitedQueue
An npm package which has a queue and a load balancing queue system.
Installation
$ npm install limitedQueue
Basic Usage
const q = ; let limited = 5; for var i = 0; i < 10; i ++ limited; limitedsize; 5 limited; 5 6 7 8 9 limited; 5
Another Simple Data Structure Module?
No.
LimitedQueue Class:
- Fits data to a specified number of bytes
- Built-in Event System
- Optimized for storage using a simple linked List
- Automatic Dequeing
AutoQueue Class:
- Limited number of items
- Automatically dequeues when limit is hit, using callback on each item
AutoQueueBalancer:
- A load balancer for an asynchronous function
- When an item is enqueued, it is pushed to the asynchronous function
- Uses a Min-Heap to prioritize which queue to delegate the job to
- Allows for simple usage of calling a lot of asynchronous functions which cannot be run on the same object
More Usage Info
LimitedQueue
const q = ; let limited = 5; let enqueueHook = limited; for var i = 0; i < 10; i ++ limited; logs OK 10 times ; limited; //Enqueueing will no longer console log. limitedsize; 5 limited; 5 6 7 8 9 limited; 5 limited; //Bytes of Storage space not including space of object limited; //Will log an item from the queue every 100 ms and remove it from the queue
AutoQueue
const q = ; let arr = ; let auto = 3 arrpush; auto; //New limit of 5 items auto; auto; //After approx. 3000 seconds, the array will have [ 1, 2, 3 ], and autoQueue will //have 4. auto; //Sets the default callback to use when dequeueAll is called.