/poolrc

Pool manager for science projects.

Primary LanguageJavaScript

poolrc

The synchronized limited-size pool is a big problem. We can use an array to count the pool size after every change. But in this case, we need this function to build whenever we need it. That's not a small task if we need size limit support, timeout support, and event support.
The poolrc does this for you.

init

const poolManager = new (require('poolrc')).base()

add data to the pool

let response = poolManager.add(
    data
);

// response {string} generated id

add data to the pool with set

let response = poolManager.set(
    name,
    data
);

// response {bool}

get data from the pool

let response = poolManager.get({
    name
});

// response {any}

edit data in the pool

let response = poolManager.edit(
    name,
    data
);

// response {bool} - faild if the set not exist

check data exist the pool

poolManager.check({
    name
});

get all data from the pool

poolManager.all();

full data export from the pool

poolManager.full();

// object 

check exist

let response = poolManager.check(
    name
);

// boolean

delete data from the pool

poolManager.del(
    name
);

drop all data from the pool

let response = poolManager.drop();

// bool true

empty check

let response = poolManager.empty();

// boolean

size of the pool

let response = poolManager.size();

// respone integer

save full data backup

poolManager.save(file_name);

load full data backup

poolManager.load(file_name);