0.0.10 • Published 5 years ago

@timvanscherpenzeel/object-pool v0.0.10

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

Object-pool

npm.io npm version dependencies devDependencies

Object pool implementation using two circular linked lists.

Installation

$ npm install --save @timvanscherpenzeel/object-pool

Usage

$ npm run lint

$ npm run test

$ npm run test:coverage

$ npm run dist

$ npm run deploy
const ObjectPool = require('@timvanscherpenzeel/object-pool');

const objectPool = new ObjectPool({
  poolSize: 25,
});

const poolNode = objectPool.alloc();

poolNode.example = 'example property';

objectPool.free(poolNode);

poolNode = null;

API

objectPool.alloc()

  • Return Type: { key: string }

Allocates an object from the reservePool and puts it into the activePool. Returns the object and marks it with a unique key in order to be cleaned up later.

objectPool.free()

  • Return Type: void

Frees an object from the activePool, cleans up its properties and puts it into the reservePool.

Licence

My work is released under the MIT licence.

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago